-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
743 lines (601 loc) · 24.1 KB
/
Copy pathzshrc
File metadata and controls
743 lines (601 loc) · 24.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# Kiro CLI pre block. Keep at the top of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh"
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
# export ZSH="/Users/chenxuanrong/.oh-my-zsh"
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="rongchenxuan"
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Skip Oh My Zsh's compaudit security scan on every startup. Re-run compaudit
# manually after changing completion/plugin directories if needed.
ZSH_DISABLE_COMPFIX="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting # Must be last plugin for proper highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
export LANG=en_AU.UTF-8
export LC_ALL=en_AU.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
export EDITOR=nvim
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Snap binaries (overrides distro packages, e.g. nvim)
export PATH=/snap/bin:$PATH
# Golang environment variables setup
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
# The next line updates PATH for the Google Cloud SDK.
# if [ -f '/Users/chenxuanrong/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/chenxuanrong/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
# if [ -f '/Users/chenxuanrong/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/chenxuanrong/google-cloud-sdk/completion.zsh.inc'; fi
# Find public ip address
alias publicip="curl ipecho.net/plain; echo"
# Zeppelin
# export ZEPPELIN_HOME=/Users/chenxuanrong/Downloads/zeppelin-0.8.1-bin-all
# alias start_zeppelin="$ZEPPELIN_HOME/bin/zeppelin-daemon.sh start"
# alias stop_zeppelin="$ZEPPELIN_HOME/bin/zeppelin-daemon.sh stop"
# aws
export PATH=/usr/local/bin/python3:$PATH
# The next line enables Confluent command
# export CONFLUENT_HOME=/Users/chenxuanrong/confluent-5.3.0/confluent
# export PATH="${CONFLUENT_HOME}/bin:$PATH"
# tabtab source for serverless package
# uninstall by removing these lines or running `tabtab uninstall serverless`
# [[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.zsh
# tabtab source for sls package
# uninstall by removing these lines or running `tabtab uninstall sls`
# [[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.zsh
# tabtab source for slss package
# uninstall by removing these lines or running `tabtab uninstall slss`
# [[ -f /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/slss.zsh ]] && . /usr/local/lib/node_modules/serverless/node_modules/tabtab/.completions/slss.zsh
bindkey -e
bindkey '\e\e[C' forward-word
bindkey '\e\e[D' backward-word
## Check IP address
function myip(){
myip="$(ifconfig | grep 'inet.*netmask.*broadcast')"
lanip="$(echo $myip | awk '{print $2}')"
publicip="$(echo $myip | awk '{print $6}')"
echo 'Your Internal IP: '$lanip
echo 'Your External IP: '$publicip
}
## pyenv configuration - lazy loaded for performance
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
# Lazy load pyenv
pyenv() {
unfunction pyenv
eval "$(command pyenv init -)"
pyenv "$@"
}
# export PATH="$HOME/.jenv/bin:$PATH"
# eval "$(jenv init -)"
# kubernete
# source <(kubectl completion zsh)
# terraform
alias tfp="terraform plan"
alias tfa="terraform apply"
alias tf="terraform"
# public ip
# myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# side-project alias
# alias sp="cd /Users/chenxuanrong/Documents/side_project/"
###-begin-npm-completion-###
#
# npm command completion script
#
# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm
#
# if type complete &>/dev/null; then
# _npm_completion () {
# local words cword
# if type _get_comp_words_by_ref &>/dev/null; then
# _get_comp_words_by_ref -n = -n @ -n : -w words -i cword
# else
# cword="$COMP_CWORD"
# words=("${COMP_WORDS[@]}")
# fi
# local si="$IFS"
# IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \
# COMP_LINE="$COMP_LINE" \
# COMP_POINT="$COMP_POINT" \
# npm completion -- "${words[@]}" \
# 2>/dev/null)) || return $?
# IFS="$si"
# if type __ltrim_colon_completions &>/dev/null; then
# __ltrim_colon_completions "${words[cword]}"
# fi
# }
# complete -o default -F _npm_completion npm
# elif type compdef &>/dev/null; then
# _npm_completion() {
# local si=$IFS
# compadd -- $(COMP_CWORD=$((CURRENT-1)) \
# COMP_LINE=$BUFFER \
# COMP_POINT=0 \
# npm completion -- "${words[@]}" \
# 2>/dev/null)
# IFS=$si
# }
# compdef _npm_completion npm
# elif type compctl &>/dev/null; then
# _npm_completion () {
# local cword line point words si
# read -Ac words
# read -cn cword
# let cword-=1
# read -l line
# read -ln point
# si="$IFS"
# IFS=$'\n' reply=($(COMP_CWORD="$cword" \
# COMP_LINE="$line" \
# COMP_POINT="$point" \
# npm completion -- "${words[@]}" \
# 2>/dev/null)) || return $?
# IFS="$si"
# }
# compctl -K _npm_completion npm
# fi
# ###-end-npm-completion-###
#
#
# function gssh() {
# readonly local name="$1"
# local filter result instance_name zone
# printf "🖥️ Connecting to instance: %s\\n\\n" "$name"
# filter="(name:${name} AND status:RUNNING)"
# result="$(gcloud compute instances list --sort-by=-createTime --format='value(name,zone)' --filter="$filter")"
# instance_name="$(echo "$result" | awk 'NR==1 {print $1}')"
# zone="$(echo "$result" | awk 'NR==1 {print $2}')"
# if [ -n "$instance_name" ]; then
# gcloud beta compute ssh "$name" --zone "$(basename "$zone")"
# else
# printf "❌ Instance not found\\n"
# fi
# }
alias cls_pyc="find . -name '*.pyc' -delete && find . -name "__pycache__" -delete"
# alias kc="kubectl"
# zk_up() {
# zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties > /dev/null 2>&1 &
# }
# zk_down() {
# zookeeper-server-stop /usr/local/etc/kafka/zookeeper.properties
# }
# kafka_up() {
# zk_up
# echo "zookeeper start..."
# kafka-server-start /usr/local/etc/kafka/server.properties > /dev/null 2>&1 &
# echo "kafka server start..."
# }
# kafka_down() {
# zk_down
# echo "zookeeper stop..."
# kafka-server-stop /usr/local/etc/kafka/server.properties
# echo "kafka server stop..."
# }
export LDFLAGS="-L/usr/local/opt/ncurses/lib"
export CPPFLAGS="-I/usr/local/opt/ncurses/include"
alias ll="ls -la"
alias ..="cd .."
alias ...="cd ../.."
alias bt="cd $HOME/domain"
alias os="cat /etc/os-release"
alias cls="clear"
function list_users() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then cut -d: -f1 /etc/passwd;
elif [[ "$OSTYPE" == "darwin"* ]]; then dscl . list /Users | grep -v "^_"
else echo "unknown os version"
fi
}
function os_version() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then uname -r;
elif [[ "$OSTYPE" == "darwin"* ]]; then sw_vers -productVersion;
else echo "unknown os version"
fi
}
# aws cli helper
function list_instances() {
aws ec2 describe-instances | jq '.Reservations[].Instances[] | {InstanceType, Tags, InstanceId}'
}
# pip zsh completion start
function _pip_completion {
local words cword
read -Ac words
read -cn cword
reply=( $( COMP_WORDS="$words[*]" \
COMP_CWORD=$(( cword-1 )) \
PIP_AUTO_COMPLETE=1 $words[1] 2>/dev/null ))
}
compctl -K _pip_completion pip
# pip zsh completion end
# Removed duplicate compinit call - already called below at line 405
# source ~/.dbt-completion.bash
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export PATH="/usr/local/opt/postgresql@9.6/bin:$PATH"
alias sp="cd ~/side_project/"
alias wget="wget --no-check-certificate"
alias up_airflow_dev="aws ec2 start-instances --instance-ids i-070f3b145665c7911"
alias down_airflow_dev="aws ec2 stop-instances --instance-ids i-070f3b145665c7911"
alias connect_db="nc -zv analytics-dev.cznmor934jee.ap-southeast-2.rds.amazonaws.com 5432"
complete -o nospace -C /usr/local/bin/terraform terraform
function cycle_logs() {
suffix=$(date '+%Y-%m-%dT%H:%M:%S')
find logs/ -name "*.log" -exec mv -v {} {}.${suffix} \;
}
# docker shortcuts
alias dps="docker ps"
export PATH="/usr/local/opt/postgresql@11/bin:$PATH"
function list_disk_uage() {
du -hsc * | sort -r -h
}
# aws helper functions
function rds_endpoints {
aws rds describe-db-instances | jq -r '.DBInstances[] | { (.DBInstanceIdentifier):(.Endpoint.Address + ":" + (.Endpoint.Port|tostring))}'
}
function lambda_settings {
aws lambda list-functions | jq ".Functions | group_by(.Runtime)|[.[]|{ (.[0].Runtime): [.[]|{ name: .FunctionName, timeout: .Timeout, memory: .MemorySize }] }]"
}
function list_ecr_repo {
aws ecr describe-repositories | jq ".repositories[] | {repositoryName: .repositoryName, repositoryUri: .repositoryUri, createdAt:.createdAt}"
}
function dbt_run_changed() {
children=$1
models=$(git diff --name-only | grep '\.sql$' | awk -F '/' '{ print $NF }' | sed "s/\.sql$/${children}/g" | tr '\n' ' ')
if [ -n "$models" ]; then
echo "Running models: ${models}"
dbt run --models $models
else
echo "No changes detected"
fi
}
#export AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id)
#export AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key)
alias dcu="docker-compose up -d"
alias dcd="docker-compose down"
# Airflow autocompletion
# autoload bashcompinit
# bashcompinit
# eval "$(register-python-argcomplete airflow)"
zstyle ':completion:*' menu select
fpath+=~/.zfunc
export HOMEBREW_NO_AUTO_UPDATE=1
function addword() {
echo $1 >> ~/study_notes/english.txt
}
alias speedtest-cli=/Users/alexrong/side_project/speedtest-cli-demo/speedtest-cli-demo/bin/speedtest-cli
# added by Snowflake SnowSQL installer v1.2
export PATH=/Applications/SnowSQL.app/Contents/MacOS:$PATH
alias week="date +%V"
#compdef _avc avc
# zsh completion for avc -*- shell-script -*-
__avc_debug()
{
local file="$BASH_COMP_DEBUG_FILE"
if [[ -n ${file} ]]; then
echo "$*" >> "${file}"
fi
}
_avc()
{
local shellCompDirectiveError=1
local shellCompDirectiveNoSpace=2
local shellCompDirectiveNoFileComp=4
local shellCompDirectiveFilterFileExt=8
local shellCompDirectiveFilterDirs=16
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
local -a completions
__avc_debug "\n========= starting completion logic =========="
__avc_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
# The user could have moved the cursor backwards on the command-line.
# We need to trigger completion from the $CURRENT location, so we need
# to truncate the command-line ($words) up to the $CURRENT location.
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
words=("${=words[1,CURRENT]}")
__avc_debug "Truncated words[*]: ${words[*]},"
lastParam=${words[-1]}
lastChar=${lastParam[-1]}
__avc_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
# For zsh, when completing a flag with an = (e.g., avc -n=<TAB>)
# completions must be prefixed with the flag
setopt local_options BASH_REMATCH
if [[ "${lastParam}" =~ '-.*=' ]]; then
# We are dealing with a flag with an =
flagPrefix="-P ${BASH_REMATCH}"
fi
# Prepare the command to obtain completions
requestComp="${words[1]} __complete ${words[2,-1]}"
if [ "${lastChar}" = "" ]; then
# If the last parameter is complete (there is a space following it)
# We add an extra empty parameter so we can indicate this to the go completion code.
__avc_debug "Adding extra empty parameter"
requestComp="${requestComp} \"\""
fi
__avc_debug "About to call: eval ${requestComp}"
# Use eval to handle any environment variables and such
out=$(eval ${requestComp} 2>/dev/null)
__avc_debug "completion output: ${out}"
# Extract the directive integer following a : from the last line
local lastLine
while IFS='\n' read -r line; do
lastLine=${line}
done < <(printf "%s\n" "${out[@]}")
__avc_debug "last line: ${lastLine}"
if [ "${lastLine[1]}" = : ]; then
directive=${lastLine[2,-1]}
# Remove the directive including the : and the newline
local suffix
(( suffix=${#lastLine}+2))
out=${out[1,-$suffix]}
else
# There is no directive specified. Leave $out as is.
__avc_debug "No directive found. Setting do default"
directive=0
fi
__avc_debug "directive: ${directive}"
__avc_debug "completions: ${out}"
__avc_debug "flagPrefix: ${flagPrefix}"
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
__avc_debug "Completion received error. Ignoring completions."
return
fi
while IFS='\n' read -r comp; do
if [ -n "$comp" ]; then
# If requested, completions are returned with a description.
# The description is preceded by a TAB character.
# For zsh's _describe, we need to use a : instead of a TAB.
# We first need to escape any : as part of the completion itself.
comp=${comp//:/\\:}
local tab=$(printf '\t')
comp=${comp//$tab/:}
__avc_debug "Adding completion: ${comp}"
completions+=${comp}
lastComp=$comp
fi
done < <(printf "%s\n" "${out[@]}")
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
__avc_debug "Activating nospace."
noSpace="-S ''"
fi
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
# File extension filtering
local filteringCmd
filteringCmd='_files'
for filter in ${completions[@]}; do
if [ ${filter[1]} != '*' ]; then
# zsh requires a glob pattern to do file filtering
filter="\*.$filter"
fi
filteringCmd+=" -g $filter"
done
filteringCmd+=" ${flagPrefix}"
__avc_debug "File filtering command: $filteringCmd"
_arguments '*:filename:'"$filteringCmd"
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
# File completion for directories only
local subdir
subdir="${completions[1]}"
if [ -n "$subdir" ]; then
__avc_debug "Listing directories in $subdir"
pushd "${subdir}" >/dev/null 2>&1
else
__avc_debug "Listing directories in ."
fi
local result
_arguments '*:dirname:_files -/'" ${flagPrefix}"
result=$?
if [ -n "$subdir" ]; then
popd >/dev/null 2>&1
fi
return $result
else
__avc_debug "Calling _describe"
if eval _describe "completions" completions $flagPrefix $noSpace; then
__avc_debug "_describe found some completions"
# Return the success of having called _describe
return 0
else
__avc_debug "_describe did not find completions."
__avc_debug "Checking if we should do file completion."
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
__avc_debug "deactivating file completion"
# We must return an error code here to let zsh know that there were no
# completions found by _describe; this is what will trigger other
# matching algorithms to attempt to find completions.
# For example zsh can match letters in the middle of words.
return 1
else
# Perform file completion
__avc_debug "Activating file completion"
# We must return the result of this command, so it must be the
# last command, or else we must store its result to return it.
_arguments '*:filename:_files'" ${flagPrefix}"
fi
fi
fi
}
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_avc" ]; then
_avc
fi
#compdef redocly
###-begin-redocly-completions-###
#
# yargs command completion script
#
# Installation: redocly completion >> ~/.zshrc
# or redocly completion >> ~/.zsh_profile on OSX.
#
_redocly_yargs_completions()
{
local reply
local si=$IFS
IFS=$'
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" redocly --get-yargs-completions "${words[@]}"))
IFS=$si
_describe 'values' reply
}
compdef _redocly_yargs_completions redocly
###-end-redocly-completions-###
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
alias shop=shopify
# Created by `pipx` on 2024-09-09 05:41:50
export PATH="$PATH:/Users/chenxuan.rong/.local/bin"
alias dbt-cloud=/opt/homebrew/bin/dbt
# netskope setup
export REQUESTS_CA_BUNDLE=~/.config/netskope/nscacert_combined.pem
export CURL_CA_BUNDLE=$REQUESTS_CA_BUNDLE
export NODE_EXTRA_CA_CERTS=$REQUESTS_CA_BUNDLE
export SSL_CERT_FILE=$REQUESTS_CA_BUNDLE
export PIP_CERT=$REQUESTS_CA_BUNDLE
alias chaws='eval $(AWS_CA_BUNDLE= aws-sso-profile set)'
alias unaws='eval $(aws-sso-profile unset)'
alias aws-sso-config='aws-sso config-profiles --force'
alias awsconsole='aws-sso-profile console'
export TLDR_AUTO_UPDATE_DISABLED=true
alias aws-creds='aws-sso credentials -p "${AWS_PROFILE}" -f ~/.aws/credentials && sed -i "" "s/${AWS_PROFILE}/default/" ~/.aws/credentials'
alias punch-dev='AWS_DEFAULT_REGION=ap-southeast-2 AWS_PROFILE=default holepunch bastion-dev-sg -4 -y -r -d "chenxuan.rong@domain.com.au" 22 443 80'
aws_docker()
{
local command='-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} -e AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}'
echo $command
echo $command | pbcopy
}
#z() {
# local dir=$(
# _z 2>&1 |
# fzf --height 40% --layout reverse --info inline \
# --nth 2.. --tac --no-sort --query "$*" \
# --accept-nth 2
# ) && cd "$dir"
#}
#. /opt/homebrew/etc/profile.d/z.sh
# fzf
source <(fzf --zsh)
# Added by dbt Fusion extension
alias dbtf=/Users/chenxuan.rong/.local/bin/dbt
# Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh"
# bun completions
# Eagerly sourcing Bun completions slows every shell. Bun remains on PATH below.
# Run this manually if you need completions in a session:
# source "/Users/chenxuan.rong/.bun/_bun"
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
# Replace <MODEL-ARN> Values
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=ap-southeast-2
export ANTHROPIC_DEFAULT_OPUS_MODEL=arn:aws:bedrock:ap-southeast-2:892978324243:application-inference-profile/11qp17otc0lo
export ANTHROPIC_DEFAULT_SONNET_MODEL=arn:aws:bedrock:ap-southeast-2:892978324243:application-inference-profile/lblbr0tbczh6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=arn:aws:bedrock:ap-southeast-2:892978324243:application-inference-profile/n965bh6fvpfi
export PATH="/Users/chenxuan.rong/.duckdb/cli/latest":$PATH
# pnpm
export PNPM_HOME="/Users/chenxuan.rong/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
# npm global packages (user-owned, no sudo needed)
export PATH="$HOME/.npm-global/bin:$PATH"
fpath+=~/.zfunc; autoload -Uz compinit; compinit
# Cortex CLI completion (disable via /settings in cortex)
[[ -s ~/.zsh/completions/cortex.zsh ]] && source ~/.zsh/completions/cortex.zsh
alias sw="snow sql -q"
alias c="claude"
# tmux session per folder.
# `tm` (no args) attaches to / creates a session
# named after the current dir's basename.
# `tm name` overrides the name.
# Works whether already inside tmux (uses switch-client) or outside it.
tm() {
command -v tmux >/dev/null 2>&1 || { echo "tmux not installed"; return 1; }
local name="${1:-$(basename "$PWD")}"
# tmux session names can't contain '.' or ':' — replace with '-'
name="${name//./-}"
name="${name//:/-}"
if [ -n "$TMUX" ]; then
tmux has-session -t "$name" 2>/dev/null || tmux new-session -d -s "$name" -c "$PWD"
tmux switch-client -t "$name"
else
tmux attach -t "$name" 2>/dev/null || tmux new -s "$name" -c "$PWD"
fi
}
# Auto-attach on interactive login: picks a session named after wherever
# you land. Plain `ssh server` lands in $HOME → session "root".
# Use `ssh server -t "cd /srv/sm.levels.io && bash -l"` to land in a site
# folder → session "sm-levels-io".
# Skips inside tmux and non-interactive shells so scp/rsync/scripted ssh keep working.
# if command -v tmux >/dev/null 2>&1 && [ -z "$TMUX" ] && [[ $- == *i* ]]; then
# tm
# fi