Skip to content

Instantly share code, notes, and snippets.

View kameshsampath's full-sized avatar

Kamesh Sampath kameshsampath

View GitHub Profile
@kameshsampath
kameshsampath / snowflake-cortex-search-type-casting.md
Created October 20, 2025 03:50
Snowflake Cortex Search: Type Casting Fix - How to properly cast ATTRIBUTES for numeric filtering

Snowflake Cortex Search: Type Casting Fix

The Issue

When using Snowflake Cortex Search with numeric ATTRIBUTES and filter comparisons (@gte, @lte, @eq), queries fail unless columns are explicitly cast to their proper types.


❌ Query That Errors

@kameshsampath
kameshsampath / snowflake_slack_webhook.sql
Last active September 5, 2025 03:56
the slack tool snippet to use with Snowflake Intelligence
-- Step 1
CREATE OR REPLACE SECRET alerts_and_notification.slack_channel_aln_webhook_secret
TYPE = generic_string
-- https://hooks.slack.com/services/YYYYYYYY/XXXXXXX
-- Your Slack Webhook Token is /YYYYYYYY/XXXXXXX
SECRET_STRING = 'YOUR_SLACK_WEBHOOK_TOKEN_HERE'
COMMENT = 'Webhook for alerts-and-notifications slack channel';
@kameshsampath
kameshsampath / commands.md
Last active April 30, 2025 18:29
JSON Flip with Snowflake CLI

JSON Flip: Complete Command Reference

A comprehensive collection of all commands and patterns from the "JSON Flip" technique for JSON-to-CSV conversion.

Basic JSON-to-CSV Conversion

Standard JSON Flip Pattern

# Basic pattern for converting JSON arrays to CSV
jq -r '(.[0] | keys_unsorted) as $keys | 
@kameshsampath
kameshsampath / conda-autoload-envrc
Created May 19, 2024 08:25
Autoload conda environment using direnv
# assumes miniconda is installed on user home
# direnv can be installed using brew install direnv or other OS specific methods
use_conda(){
local conda_setup="$("$HOME/miniconda3/bin/conda" 'shell.zsh' 'hook' 2> /dev/null)"
eval "$conda_setup"
conda activate <name of your conda environment to load>
}
strict_env
use conda
@kameshsampath
kameshsampath / Taskfile.yaml
Created February 20, 2023 07:44
A taskfile to install tools for rust
# https://taskfile.dev
version: "3"
tasks:
default:
desc: The default task that will be run when task is called without explicit task name
aliases:
- all
cmds:
- task: install_packages
@kameshsampath
kameshsampath / Dockefile.rustlang.zig
Last active February 20, 2023 07:43
A custom docker file with rustlang tools and dependencies
#syntax=docker/dockerfile:1.3-labs
FROM --platform=$TARGETPLATFORM rust:1.67-alpine3.17 AS bins
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/usr/local/cargo/registry \
apk add -U --no-cache alpine-sdk gcompat go-task \
&& cargo install cargo-zigbuild
@kameshsampath
kameshsampath / grpc_envoy.yaml
Created November 16, 2022 05:15
Envoy YAML to expose gRPC service over http
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 }
# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@kameshsampath
kameshsampath / gateway-cors-1.yaml
Created August 2, 2021 15:25
Allowing CORS Origins
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: fruits-api
namespace: my-gloo
spec:
displayName: FruitsAPI
virtualHost:
options:
cors:
msg: "[protoc -I/Users/kameshs/git/solo-io/gloo/vendor_any -I/Users/kameshs/git/solo-io/gloo/vendor_any/github.com/solo-io/protoc-gen-ext -I/Users/kameshs/git/solo-io/gloo/vendor_any/github.com/solo-io/protoc-gen-ext/external -I/Users/kameshs/git/solo-io/gloo/vendor_any/github.com/envoyproxy/protoc-gen-validate -I/Users/kameshs/git/solo-io/gloo/vendor_any/github.com/solo-io/gloo/projects/gloo/api/external -I/Users/kameshs/git/solo-io/gloo/vendor_any/github.com/solo-io/solo-kit/api/external --openapi_out=yaml=true,single_file=false,max_description_characters=0,include_description=false:/var/folders/42/cf1r2rm562b3ss1cf_dt38rc0000gn/T/405539825/external_options -o /var/folders/42/cf1r2rm562b3ss1cf_dt38rc0000gn/T/schema-gen-979669148 --include_imports --include_source_info github.com/solo-io/gloo/projects/gateway/api/v1/external_options.proto] failed: github.com/solo-io/gloo/projects/gateway/api/v1/external_options.proto:9:1: warning: Import google/protobuf/wrappers.proto is unused.\ngithub.com/solo-io/gloo/proj