Last active
September 2, 2026 16:20
-
-
Save mrnkr/69067d217caa1afda798bea47d9d76ae to your computer and use it in GitHub Desktop.
My zsh aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias intel="arch -x86_64" | |
| alias pff="alto containers port-forward temporal-frontend,temporal-web,scriptdash,kafka,postgresql,pharmacy-db,core-api" | |
| alias pfs="alto containers port-forward kafka,postgresql,redis-master" | |
| alias kfkevt="kubectl exec -n shared-services shared-services-kafka-controller-0 -- \ | |
| kafka-console-consumer.sh \ | |
| --bootstrap-server localhost:9092 \ | |
| --topic development.fuzion_api.v1.ingestion.ingestion_event \ | |
| --from-beginning" | |
| alias rc="bin/spring stop && bin/rails c" | |
| alias scriptdash="bin/spring stop && yarn start --secure" | |
| # kubectl shortcuts to use fzf to search resources | |
| alias kctx='kubectl config use-context $(kubectl config get-contexts | fzf | tr -s " " | cut -d " " -f 2)' | |
| klogs() { | |
| if [ -n "$1" ]; then | |
| kubectl logs -n "$1" -f $(kubectl get pods -n "$1" | fzf | tr -s " " | cut -d " " -f 1) | |
| else | |
| selection=$(kubectl get pods --all-namespaces | fzf | tr -s " ") | |
| [ -z "$selection" ] && return | |
| namespace=$(echo "$selection" | cut -d " " -f 1) | |
| pod_name=$(echo "$selection" | cut -d " " -f 2) | |
| kubectl logs -n "$namespace" -f "$pod_name" | |
| fi | |
| } | |
| krails() { | |
| if [ -n "$1" ]; then | |
| kubectl exec -n "$1" -it $(kubectl get pods -n "$1" | fzf | tr -s " " | cut -d " " -f 1) -- env TEMPORAL_METRICS_ENABLED=false FUZION_TEMPORAL_METRICS_ENABLED=false bundle exec rails console | |
| else | |
| selection=$(kubectl get pods --all-namespaces | fzf | tr -s " ") | |
| [ -z "$selection" ] && return | |
| namespace=$(echo "$selection" | cut -d " " -f 1) | |
| pod_name=$(echo "$selection" | cut -d " " -f 2) | |
| kubectl exec -n "$namespace" -it "$pod_name" -- env TEMPORAL_METRICS_ENABLED=false FUZION_TEMPORAL_METRICS_ENABLED=false bundle exec rails console | |
| fi | |
| } | |
| kexec() { | |
| local namespace="" | |
| if [ "$1" = "-n" ]; then | |
| namespace="$2" | |
| shift 2 | |
| fi | |
| local script="$1" | |
| shift | |
| if [ -z "$script" ]; then | |
| echo "usage: kexec [-n namespace] path_to_script [args...]" >&2 | |
| return 1 | |
| fi | |
| if [ -n "$namespace" ]; then | |
| cat "$script" | kubectl exec -n "$namespace" -i $(kubectl get pods -n "$namespace" | fzf | tr -s " " | cut -d " " -f 1) -- env DISABLE_SPRING=1 TEMPORAL_METRICS_ENABLED=false FUZION_TEMPORAL_METRICS_ENABLED=false bundle exec rails runner - "$@" | |
| else | |
| selection=$(kubectl get pods --all-namespaces | fzf | tr -s " ") | |
| [ -z "$selection" ] && return | |
| namespace=$(echo "$selection" | cut -d " " -f 1) | |
| pod_name=$(echo "$selection" | cut -d " " -f 2) | |
| cat "$script" | kubectl exec -n "$namespace" -i "$pod_name" -- env DISABLE_SPRING=1 TEMPORAL_METRICS_ENABLED=false FUZION_TEMPORAL_METRICS_ENABLED=false bundle exec rails runner - "$@" | |
| fi | |
| } | |
| kenv() { | |
| if [ -n "$1" ]; then | |
| kubectl exec -n "$1" -it $(kubectl get pods -n "$1" | fzf | tr -s " " | cut -d " " -f 1) -- env | |
| else | |
| selection=$(kubectl get pods --all-namespaces | fzf | tr -s " ") | |
| [ -z "$selection" ] && return | |
| namespace=$(echo "$selection" | cut -d " " -f 1) | |
| pod_name=$(echo "$selection" | cut -d " " -f 2) | |
| kubectl exec -n "$namespace" -it "$pod_name" -- env | |
| fi | |
| } | |
| # kubectl restart | |
| alias krestart='kubectl rollout restart deployment/$(kubectl get deployments | fzf | tr -s " " | cut -d " " -f 1)' | |
| # better rspec | |
| rspec-lean() { | |
| setopt local_options pipefail | |
| bundle exec rspec -fd --force-color "$@" | awk -v root="$(pwd)/" ' | |
| /\/gems\// || /\.rbenv\// || /\/ruby\// || /\/bundler\// { next } | |
| /^[a-zA-Z0-9_-]+ \([0-9]+\.[0-9]+/ { next } | |
| { | |
| gsub(/\[[^]]*\]/, "") | |
| while ((i = index($0, root)) > 0) { | |
| $0 = substr($0, 1, i-1) "" substr($0, i + length(root)) | |
| } | |
| fflush() | |
| } | |
| ' | tee /tmp/rspec.last.out | |
| } | |
| rspec-explain() { | |
| local prompt="${*:-explain the rspec failures, focus on root cause, look only at the provided rspec output}" | |
| local input; input=$(mktemp) | |
| sed -E $'/\x1b\\[[0-9;]*32m/d; /^request_base_url=/d; /^request_id=/d; /^method=(GET|POST|PUT|PATCH|DELETE) /d; s/\x1b\\[[0-9;]*m//g' /tmp/rspec.last.out > "$input" | |
| if [[ ! -s "$input" ]]; then | |
| echo "nothing left after filtering green lines" >&2 | |
| rm -f "$input"; return 0 | |
| fi | |
| echo "feeding $(wc -c < "$input") bytes to claude…" >&2 | |
| local out; out=$(mktemp) | |
| local chars=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏) | |
| trap 'printf "\r\e[K" >&2; kill $pid 2>/dev/null; rm -f "$out" "$input"; return 130' INT | |
| (claude -p "$prompt" < "$input" > "$out") & | |
| local pid=$! | |
| local i=1 | |
| while kill -0 $pid 2>/dev/null; do | |
| printf '\r\e[36m%s\e[0m thinking…' "${chars[i]}" >&2 | |
| i=$(( i % ${#chars[@]} + 1 )) | |
| sleep 0.1 | |
| done | |
| wait $pid | |
| printf '\r\e[K' >&2 | |
| trap - INT | |
| cat "$out" | |
| rm -f "$out" "$input" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment