-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
890 lines (683 loc) · 25.1 KB
/
.aliases
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
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
#!/usr/bin/env bash
# shellcheck shell=bash
####################################################################################################
# Tim's shell aliases
# https://github.com/tdmalone/dotfiles/blob/master/.aliases
#
# See also: https://github.com/tdmalone/dotfiles/blob/master/.functions
#
# Copyright (c) 2018-2019 Tim Malone
# License: https://github.com/tdmalone/dotfiles/blob/master/LICENSE
#
# Sorted by category and then (generally) alphabetically
# Any sensitive information is expected to be provided by environment variables in a separate file
#
# DISCLAIMER:
# These have been written for my use-case only and have not been thoroughly tested in different
# circumstances. I use macOS with zsh and additional GNU utils, and generally try to keep all
# third-party tools fairly up-to-date. Your mileage may vary on different platforms and versions.
####################################################################################################
####################################################################################################
# Assorted aliases
####################################################################################################
##########################
# New unsorted
##########################
alias code='/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code'
alias cfnl='cfn-lint **/*.yaml'
alias sectriage="sed -e 's/[A-Z]/+/g' -e 's/^\+/scale=2; (/' -e 's/$/)\/16/' | bc --mathlib"
alias c9describe='aws cloud9 describe-environments --environment-ids $(aws cloud9 list-environments | jq -r ".environmentIds[]")'
alias c9share='aws cloud9 create-environment-membership \
--environment-id $(aws cloud9 list-environments | jq -r ".environmentIds[]") \
--user-arn $(aws sts get-caller-identity | jq -r .Arn) \
--permissions read-write'
alias c9mships='aws cloud9 describe-environment-memberships'
function ess() {
realm="${1}"
hostname="${2}"
#sudo true # Only needed (for convenience - to get password up front) if port is < 1024
eval "a${realm}"
AWS_TUNNEL_SKIP_CHECKS="${AWS_TUNNEL_SKIP_CHECKS:-true}" aws_tunnel ${hostname} 443 "${TF_VAR_elasticsearch_port}"
areset
}
alias igrep='grep -i'
alias tpv='tpview'
alias tpvt='tpviewtarget'
alias tipv='ti && tpv'
alias git_lose_last_commit='git uncommit && git reset && gco .'
alias soun='sort | uniq'
alias raq='read_app_queue'
alias ace_dev_env='kops && aops && aws_tunnel man-db.o && aws_tunnel db-r-01.o 6379 6379 && awslt && assh man.o'
alias ec='ecctl'
export ecid='eb791499706f42e7ad11b7676fd4ccc1'
alias sbd='sam build --use-container && sam deploy'
alias fbd='cd ~/functionbeat && ./functionbeat -v -e -d "*" deploy -c ~/astute/lambdaland/functionbeat/functionbeat.yml -E cloud.id="${ELASTIC_CLOUD_ID}" -E cloud.auth="${ELASTIC_USERNAME_AWS_LOG_INGEST}:${ELASTIC_PASSWORD_AWS_LOG_INGEST}"'
alias fbu='cd ~/functionbeat && ./functionbeat -v -e -d "*" update -c ~/astute/lambdaland/functionbeat/functionbeat.yml -E cloud.id="${ELASTIC_CLOUD_ID}" -E cloud.auth="${ELASTIC_USERNAME_AWS_LOG_INGEST}:${ELASTIC_PASSWORD_AWS_LOG_INGEST}"'
alias fbdcw='(fbd functionbeat-ingest-cloudwatch-logs)'
alias fbdsqs='(fbd functionbeat-ingest-sqs-to-elasticsearch)'
alias fbucw='(fbu functionbeat-ingest-cloudwatch-logs)'
alias fbusqs='(fbu functionbeat-ingest-sqs-to-elasticsearch)'
# Add '--disable-noqa' to ignored 'skipped' errors
alias pyl='echo -e "\nlinting with flake8...\n" && python3.8 -m flake8 --count --show-source && echo "all is good!"'
alias pyt='PYTHONPATH="${PWD}/handlers:${PYTHONPATH}" python3.8 -m pytest --verbose'
alias pytrp='pyt -rP' # Includes output from everrrrything
alias pylt='pyl && echo && pyt'
alias pytc='python3.8 -m coverage run -m pytest && coverage html && open htmlcov/index.html'
alias ssht='ssh tim'
alias terraform='terraform0.13'
alias tf011='terraform0.11'
alias tf012='tf 0.12upgrade'
alias t011='tf011'
alias t012='tf012'
alias tf11='tf011'
alias tf12='tf012'
alias t11='tf011'
alias t12='tf012'
alias tf_list_resource_types="tfsl | sed -e 's/module\.[A-Za-z0-9_]*\.//g' -e 's/\[[a-z0-9\.\"\*-_]*\]//g' -e 's/\.[a-z0-9_-]*$//' -e 's/^data\.//' | sort | uniq"
alias rmb='remove_multiple_blanks'
alias teb='tighten_empty_blocks'
alias pa='pull_all'
alias tniceplan="ggrep --invert --extended-regexp '^(Refreshing Terraform state in-memory|The refreshed state will be used|persisted to local or remote|.*: Refreshing state\.\.\.|An execution plan has been|Terraform will perform the following|Resource actions are indicated with|\s+\+ create|\s+~ update|\s+\- destroy|\-/\+ destroy|\s?<= read|\-{72}|This means that Terraform did not detect|configuration and real physical resources|actions need to be performed)' | ggrep --invert --extended-regexp '^\s+([a-zA-Z]|\"|\{|\}|\(|\)|\[|\])' | ggrep --invert --extended-regexp '\(known after apply\)$' | gsed 's/\s\+{$//' | gsed 's/\s\+\[$//' | gsed 's/($//' | gsed 's/,$//' | gsed $'s/^\\\(Plan: .*\\\)$/\\\1\\\n/g' | gcat --squeeze-blank"
##########################
# Sorted assorted
##########################
alias c='cls'
alias calc='echo "Enter your maths equations, or type \"quit\" to exit." && bc --quiet'
alias cls='clear'
alias conn='ping 8.8.8.8'
#alias conn='ping google.com'
alias copy='pbcopy'
alias disk='sudo du -d1 -hx | sort -rh'
alias e='exit'
alias ecn='echo -n'
alias ex='export'
alias exp='export'
alias exe='chmod +x'
alias flushdns='sudo killall -HUP mDNSResponder' # Only useful on Macs.
alias headers='curl --silent --location --dump-header /dev/stdout --output /dev/null'
alias ip='curl api.ipify.org'
alias l='ll'
alias ll='ls -alFA'
alias powershell='pwsh'
alias psh='pwsh'
alias rec='asciinema rec'
alias s='sudo su -'
alias sc='screen -rd || screen'
alias scr='scratchpad'
alias scratch='scratchpad'
alias scratchpad='code ~/Desktop/scratchpad'
alias screen='screen -rd || screen'
alias scwd='sudo su'
alias sp='scratchpad'
alias suniq='sort | uniq'
# Make sudo work with aliases. May not work properly though...
# @see https://askubuntu.com/a/22043/421637
#alias sudo='sudo '
alias tm='tmux attach || tmux'
alias tms='tmux source-file ~/.tmux.conf && echo tmux configuration reloaded'
alias trace='traceroute'
alias tracert='traceroute'
alias x='exe'
alias wx='curl wttr.in/melbourne'
##########################
# Quick file opens
##########################
alias al='code ~/.aliases'
alias alvi='vi ~/.aliases'
alias aconfig='awsc'
alias awsc='code ~/.aws/credentials'
alias awsc2='code ~/.aws/config'
alias awsco='code ~/.aws/config'
alias awsconfig='awsc'
alias en='code ~/.env'
alias envi='vi ~/.env'
alias func='code ~/.functions'
alias gconfig='gitc'
alias gitc='code ~/.gitconfig'
alias gitconfig='gitc'
alias kconfig='kubec'
alias kubec='code ~/.kube/config'
alias kubeconfig='kubec'
alias sconfig='sshc'
alias sshc='code ~/.ssh/config'
alias sshconfig='sshc'
alias sshcvi='vi ~/.ssh/config'
alias sshkh='code ~/.ssh/known_hosts'
alias sshkn='code ~/.ssh/known_hosts'
alias zconfig='zshc'
alias zshc='code ~/.zshrc'
alias zshrc='code ~/.zshrc'
####################################################################################################
# Third party programs & services
####################################################################################################
##########################
# Ansible
##########################
alias ag='ansible-galaxy'
alias agi='ag install'
alias an='ansible'
alias ap='ansible-playbook --diff --inventory "${TIM_WORK_HOMEDIR}/ansible/aws-inventory"'
alias apb='ap'
alias apbm='apm'
alias apm='ap main.yml --vault-password-file "${HOME}/.ansible/$(basename $(pwd))"'
alias apml='apm --limit'
alias apmt='apm --tag'
alias book='ap'
alias upd='updall -l'
alias updall='apb "${TIM_WORK_HOMEDIR}/tools/tim-tools/tim-playbook.yml"'
# TODO.
alias ad='ansible localhost -m debug -a "var=ENTER_VAR_HERE" --vault-password-file=~/.ansible/ENTER_VAULT_PASSWORD_FILE_HERE'
alias ae='ansible-vault encrypt_string --vault-id=ENTER_VAULT_NAME_HERE@prompt --encrypt-vault-id ENTER_VAULT_NAME_HERE'
##########################
# AWS
# see also: AWS EC2, AWS EKS
##########################
alias alo='alogout'
alias alogout='areset && unset AWS_PROFILE'
alias amfa='areset && aws-mfa'
alias amfaf='amfa --force'
alias amp='amplify'
alias ascp='aws_scp'
alias asmfa='areset && aws-mfa --assume-role arn:aws:iam::${AWS_WORK_TIM_ACCOUNT_ID}:role/OrganizationAccountAccessRole --duration 43200'
alias asu='asudo'
alias assh='aws_ssh'
alias aupd='rm -f ~/.zshrc_tdm_aws_context.* || true'
alias awscs='aws configure set'
alias awskt='awstk'
alias awslt='awstl'
alias awsm='mysql --host 127.0.0.1 --port 10010 --password --user'
alias awss='areset && aws_switch'
alias awst='awstl && AWS_TUNNEL_SKIP_CHECKS="${AWS_TUNNEL_SKIP_CHECKS:-true}" aws_tunnel'
alias awstk='aws_tunnel --kill-all'
alias awstl='aws_tunnel --list'
alias cll='aws logs'
alias ecr='aws ecr'
alias ecs='ecs-cli'
alias elb='aws elbv2'
alias gci='sts get-caller-identity'
alias klg='kms list-grants --key-id'
alias kms='aws kms'
alias r53='aws route53'
alias r53d='aws route53domains'
alias rds='aws rds'
alias running_instances='ec2 describe-instances --filters Name=instance-state-name,Values=running | jqr ".Reservations[].Instances[].Tags[] | select(.Key == \"Name\").Value" | sort'
alias s3='aws s3'
alias s32='aws s3api'
alias s3a='aws s3api'
alias si='start_instance'
alias si2='stop_instance'
alias sns='aws sns'
alias sqs='aws sqs'
alias sts='aws sts'
alias term_instance='terminate_instance'
#alias ti='terminate_instance'
##########################
# AWS EC2
# see also: AWS
##########################
alias ec2='aws ec2'
##########################
# AWS EKS
# see also: Kubernetes
##########################
alias ek='ak'
alias eks='aws eks'
alias eksc='eksctl'
# TODO: awstk - but only for k8s tunnels??
alias k8ss='areset && AWS_TUNNEL_SKIP_CHECKS="${AWS_TUNNEL_SKIP_CHECKS:-true}" AWS_SWITCH_MODE="smart" AWS_TUNNEL_LOCAL_PORT="${TF_VAR_k8s_port}" k8s_switch'
alias kaws='ak'
alias kaws2='kubernetic && kuse kubernetic'
##########################
# Azure
##########################
alias azl='az login'
##########################
# Composer
##########################
alias cl='composer lint'
alias ct='composer test'
##########################
# Datadog
##########################
alias dda='sudo datadog-agent'
##########################
# Docker
##########################
alias docker-composer='docker-compose'
alias datt="docker attach \$(basename \$(pwd))Instance" # Reattach a terminal & stdin.
alias dcb="dcp build"
alias dcd="dcp down"
alias dcdv="dcd --volumes"
alias dceb="dcp exec app bash"
alias dcl="dcp logs --follow"
alias dcp="docker-compose"
alias dcr="dcp run --rm"
alias dcrb="dcp run app bash"
alias dcrs="dcdv && dcud"
alias dcs="dcp stop"
alias dcu="dcp up"
alias dcub="dcu --build"
alias dcud="dcu --detach"
alias dcubd="dcub --detach"
alias dcudb="dcub --detach"
alias di="docker images"
alias dlog="docker logs \$(basename \$(pwd))Instance"
alias drm="dstop && docker rm \$(basename \$(pwd))Instance"
alias drs="docker restart \$(basename \$(pwd))Instance"
alias dps="docker ps -a"
alias drunv="docker run -d -p 8080:80 -p 8081:443 -v '\$(pwd)'/src:/var/www/html/src --name \$(basename \$(pwd))Instance \$(basename \$(pwd))"
alias drun="docker run -d -p 8080:80 -p 8081:443 --name \$(basename \$(pwd))Instance \$(basename \$(pwd))"
alias dstart="docker start \$(basename \$(pwd))Instance"
alias dstop="docker stop \$(basename \$(pwd))Instance"
# @see https://stackoverflow.com/questions/44722341/docker-login-unknown-shorthand-flag-e
#alias daws='$(AWS_DEFAULT_REGION="${AWS_TIM_DESIRED_REGION}" ecr get-login --no-include-email)'
alias daws='AWS_DEFAULT_REGION="${AWS_TIM_DESIRED_REGION}" ecr get-login-password | docker login --username AWS --password-stdin "${AWS_WORK_MASTER_ACCOUNT_ID}.dkr.ecr.${AWS_TIM_DESIRED_REGION}.amazonaws.com"'
alias dlogin="daws"
# WARNING: Some of these have only been tested in Git Bash on Windows.
# TODO: See more at https://github.com/tcnksm/docker-alias/blob/master/zshrc
# Run bash in a Docker container, assuming the container is named (your current basename)Instance.
alias dbash="docker start \$(basename \$(pwd))Instance && docker exec -it \$(basename \$(pwd))Instance bash"
# Build in the current directory.
alias dbuild="docker build -t \$(basename \$(pwd)) \$(pwd)"
# Enter a failed build container at the point it failed.
# TODO: This doesn't run the final command yet due to xargs not coming from a tty.
# shellcheck disable=SC2142
alias denter="docker ps -a | awk '{print \$1}' | awk 'NR==2' | xargs docker commit | sed s/sha256:// | xargs -I % echo Run this command: docker run -it % bash -il"
# Stop and remove ALL Docker containers.
# shellcheck disable=SC2142
alias drmc="echo && echo 'Removing all Docker containers...' && echo && docker ps -a | awk '{print \$1}' | grep -v CONTAINER | xargs docker stop | xargs docker rm"
# Remove ALL Docker images.
# TODO: Add a command that will docker rmi on any <none>'s in column 1 of docker images.
# shellcheck disable=SC2142
alias drmi="echo && echo 'Removing all Docker images...' && echo && docker images | awk '{print \$3}' | grep -v IMAGE | xargs docker rmi"
##########################
# Git
##########################
# Note that git aliases themselves should be defined in .gitconfig.
alias bfg='java -jar ~/bfg.jar'
alias ga='git add'
alias gaa='git add .'
alias gam='git amend'
alias gap='git add --patch'
alias gb='git branch'
alias gc='git commit'
alias gcam='git commit --all -m'
alias gce="git commit --allow-empty -m 'Empty commit for testing'"
alias gcm='git commit -m'
alias gcmvb="git commit -m \"Version bump\" && gt"
alias gcmvbc="git commit -m \"Version bump; changelog\" && gt"
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcod='git checkout develop'
alias gcom='git checkout master'
alias gcp='git cherry-pick'
alias gd='git diff'
alias gdb='git delbranch'
alias gdc='git diff --cached'
alias gdm='git delmerged'
alias gf='git fix'
alias gg='git grep --ignore-case'
alias ggh='git grep --max-depth=0' # i.e. 'git grep here'
#alias gh='git hub'
alias gl='git latest'
alias glm='gl --no-merges'
alias glmm='glm master..'
alias glmd='glm develop..'
alias gm='git merge'
alias gn='git noff'
alias gnb='git newbranch'
alias gp='git push'
alias gpf='gp --force'
alias gpft='gp --follow-tags'
alias gpl='git pull'
alias gpr='gpl --rebase'
alias gpta='gp && gp --tags'
alias gpuo='gp --set-upstream origin'
alias gr='grv'
alias grb='git rebase'
alias grbi='git rebase --interactive'
alias grso='git remote set-url origin'
alias grv='git remote --verbose'
alias gs='git status'
alias gse='git show-encrypted'
alias gsp='git stash --patch'
alias gt='git tag'
alias gu='git update'
alias gus='git unstash'
alias gup='git stash && gcom && gpl && gdm'
# TODOs without a ticket:
alias tdt='git grep TODO | grep -v "TODO: \[OP-" | grep -v "TODO: Reference "'
alias tdtc='tdt | wc -l'
alias tempbranch='git checkout -b temp/applies && git branch | grep -v temp/applies | xargs -L 1 git merge --no-edit'
##########################
# Google Cloud
##########################
alias fb='firebase'
alias gcl='gcloud auth application-default login'
##########################
# GPG
##########################
alias gpglk='gpg --list-keys --keyid-format short'
##########################
# Gulp
##########################
alias g='gulp'
alias glh='gulp lint:html'
alias gli='gulp lint'
alias glj='gulp lint:js'
alias glp='gulp lint:php'
alias gls='gulp lint:sass'
alias gre='gulp release'
alias gv='gulp version'
##########################
# Hadolint
##########################
alias dl='hadolint'
alias hadolint='docker run --rm -i hadolint/hadolint < Dockerfile'
##########################
# Heroku
##########################
alias hl='heroku local'
alias hlog='heroku logs --tail'
##########################
# jq
##########################
alias jqr='jq --raw-output'
alias jqj='jq --join-output' # like echo -n
##########################
# Jupyter
##########################
alias j='jupyter'
alias jn='j notebook'
##########################
# Kubernetes
# see also: AWS EKS
##########################
alias h='helm'
alias k='kubectl'
alias ka='k apply'
alias kaf='ka --filename'
alias kapi='k api-resources | sort'
alias kas='kns "${K8S_TIM_DESIRED_NAMESPACE}"'
alias kaskp='kas && kp'
alias kc='k config'
alias kccc='kc current-context'
alias kcgc='kc get-contexts'
alias kci='k cluster-info'
alias kcon='kc current-context'
#alias kcp='k cp'
# @see https://github.com/kubernetes/kubectl/issues/483#issuecomment-474112855
#alias kclear='sed -i.bak -e"s/^current-context:.*$/current-context:/" ~/.kube/config'
alias kclear='kubectl config unset current-context'
alias kclr='kclear'
alias kd='k describe'
#alias kdash='k create --filename https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml; k create clusterrolebinding dashboard-admin --namespace monitoring --clusterrole=cluster-admin --serviceaccount=monitoring:dashboard; kpx'
alias kdash='kpx'
alias kdd='kd deployments'
alias kdel='rm ~/.kube/config'
alias kdf='k diff'
alias kdi='kd ingress'
alias kdn='kd nodes'
alias kdp='kd pods'
alias kds='kd svc'
alias kdtoken='kgse $(kgsa kubernetes-dashboard --namespace monitoring --output jsonpath="{.secrets[0].name}") --namespace monitoring --output jsonpath="{.data.token}" | base64 --decode | copy && echo "A Kubernetes dashboard token has been copied to your clipboard."'
alias kdt='kdtoken'
alias ke='kex'
alias kex='k exec'
alias ked='k edit'
alias kedit='ked'
alias kg='k get'
alias kgcr='kg clusterroles'
alias kgd='kg deployments'
alias kgds='kg daemonsets'
alias kge='kg events'
alias kgi='kg ingress'
alias kgn='kg nodes'
alias kgns='kg namespaces'
alias kgp='kg pods'
alias kgr='kg roles'
alias kgs='kg services'
alias kgsa='kg serviceaccounts'
alias kgse='kg secrets'
alias khp='kg hpa'
alias khpa='khp'
alias khpaw='khpw'
alias khpw='khp --watch'
alias ki='kgi'
alias kl='k logs --all-containers=true --follow=true'
alias klo='kclear'
alias kmon='kns monitoring'
alias kmonkp='kmon && kp'
alias kn='kgn'
alias kname='kns'
alias knamespace='kns'
alias knkp='kn && kp'
alias kns='kc set-context --current --namespace'
alias knw='kn --watch'
alias kp='kgp'
alias kpal='kp --all-namespaces'
alias kpan='kpal'
alias kpen='kpal | grep Pending || true'
alias kpw='kp --watch'
alias kpx='kdtoken && open "http://localhost:8001/api/v1/namespaces/monitoring/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=astute" && k proxy &'
alias kr='krestart'
alias ks='kgs'
alias ksw='ks --watch'
alias ksys='kns kube-system'
alias ksyskp='ksys && kp'
alias kt='kubetail'
alias kuse='kc use-context'
alias kv='k version'
alias kvs='kv --short'
alias mk='minikube'
alias n='nodes'
##########################
# Keybase
##########################
alias kb='keybase'
##########################
# Lambda
##########################
# Test a Lambda function in the current directory using LambCI's Docker images.
alias lambda="docker run --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --env AWS_DEFAULT_REGION --rm -v \$(pwd):/var/task lambci/lambda:nodejs8.10 index.handler"
##########################
# Lint fixes (assorted)
##########################
alias el='DEBUG=eslint:cli-engine eslint --color --env es6:true --parser-options ecmaVersion:9 *.js'
alias lf='lfj && lfs && lfp'
# shellcheck disable=SC2142
alias lfj="git ls-tree -r HEAD | grep \"\\.js$\" | awk '{print \$4}' | xargs node_modules/.bin/eslint --ignore-pattern '!.*.js' --fix"
# shellcheck disable=SC2142
alias lfs="git ls-tree -r HEAD | grep \"\\.scss$\" | awk '{print \$4}' | xargs node_modules/.bin/stylelint --fix"
# shellcheck disable=SC2142
alias lfp="git ls-tree -r HEAD | grep \"\\.php$\" | awk '{print \$4}' | xargs vendor/bin/phpcbf"
##########################
# Make
##########################
alias m='make'
alias mb='m build'
alias mi='m init'
alias ml='m lint'
alias mp='m push'
alias mr='m run'
alias mt='m test'
##########################
# ngrok
##########################
alias ng='ngrok'
alias ng5k='ngrok 5000'
alias ngrok='~/ngrok http --subdomain "${NGROK_TIM_DESIRED_SUBDOMAIN}" --region au'
alias ngrok='~/ngrok http --region au'
##########################
# Node.js
##########################
alias ni='node index.js'
##########################
# Packer
##########################
alias pb='pk build'
alias pbc='amfa && ../../build.sh .'
alias pbcd='pbcdebug'
alias pbcdebug='amfa && PACKER_DEBUG_MODE=true ../../build.sh .'
alias pk='packer'
alias pkv='pv'
alias pv="find *.packer.json | xargs -I % sh -c 'echo % && packer validate %'"
##########################
# PHP
##########################
alias art='php artisan'
alias p='php'
##########################
# Redis
##########################
alias red='redis-cli'
alias redis='redis-cli'
##########################
# Papertrail
##########################
alias pt='papertrail'
##########################
# Python
##########################
alias pip='pip3'
alias pipclean='venv && pip freeze | grep -v "^-e" | xargs pip uninstall -y'
alias pl='pylint'
alias pla='pylint ace'
alias pla2='dcb && dcr --rm app pylint ace'
alias pll='pl lambda_function.py | less'
alias py='python'
#alias python='python3'
alias ve='venv'
alias vcreate='vecreate'
alias vec='vecreate'
alias vecreate='python3 -m venv venv'
alias ved='deactivate'
alias venv='source venv/bin/activate'
alias vupd='venv && pip3 install --editable . && pip3 install --requirement requirements-dev.txt'
##########################
# Serverless
##########################
alias sl='serverless'
##########################
# SSH
##########################
# Generates a 4096 bit RSA key with an empty passphrase, expecting a comment to be passed in.
alias sshk='ssh-keygen -t rsa -f sshkey-"$( date +%Y%m%d-%H%M%S )" -b 4096 -P "" -C'
alias sshkey='sshk'
##########################
# Terminus (Pantheon CLI)
##########################
alias terminus='~/vendor/bin/terminus'
##########################
# Terraform
##########################
function terraform_modules_used_in_this_folder(){
ggh source | awk '{print $4}' | grep '\.\./' | grep -v '\.\./\.\.x/' | sed -e 's/"//g' -e 's/\(\.\.\/\)*\(modules\/\)*//' | soun
}
alias t='terraform'
alias tf='t'
alias ta='t apply'
alias taa='echo "TERRAFORM WILL AUTO APPROVE - ARE YOU SURE?" && printf "Press any key to continue..." && read ans && ta -auto-approve'
alias tai='tanow'
alias tanow='t apply -var "apply_immediately=true"'
alias tap='ta -parallelism=1'
alias tat='tf_target ta'
alias tata='tf_target taa'
alias tatp='tf_target tap'
alias tiat='ti && tat'
alias tfa='ta'
alias tfaa='taa'
alias tfc='t console'
alias tfd='t destroy'
alias tfdt='tf_target tfd'
alias tfdaa='echo "!!! DESTROY !!! TERRAFORM WILL AUTO APPROVE THIS DESTROY - ARE YOU SURE?" && printf "Press any key to continue..." && read ans && tfd -auto-approve'
alias tfdtaa='tf_target tfdaa'
alias tff='tf fmt'
alias tff="find . -name '*.tf' | sed 's/^\.\/\(.*\)\/.*/\1/' | sort | uniq | xargs -I % terraform fmt %"
alias tff='tf fmt -recursive'
alias tfind='tfsl | grep'
alias ti='t init'
alias tia='ti && ta'
alias tin='ti'
alias tip='ti && tp'
alias tir='ti --reconfigure'
alias tiu='ti -upgrade=true'
alias tiv='ti && tv'
alias tfi='ti'
alias tfin='ti'
alias tfim='t import'
alias tfl='tflint'
#alias tflint='docker run --rm --tty --volume "$( pwd )":/data wata727/tflint --error-with-issues --quiet'
#alias tflint="find . -name '*.tf' | sed 's/^\.\(.*\)\/\(.*\)\.tf$/.\1/' | sed 's/^\///' | sort | uniq | grep -v '/modules/' | xargs -I % bash -c 'echo % && cd % && tflint --deep --module'"
alias tfo='t output'
alias to='tfo'
alias tp='t plan'
alias tplf='tp -lock=false'
alias tplfo='tplf -out'
alias tplft='tplf -target'
alias tpo='tp -out'
alias tpt='tf_target tp'
alias tfp='tp'
alias tq='tquick'
alias tqt='tf_target tq'
alias tquick='tp -refresh=false -lock=false -input=false'
alias tfr='t refresh'
alias tfsl='t state list'
alias tfsm='t state mv'
alias tfsr='tfsrm'
alias tfsrm='t state rm'
alias tfs='tf show'
alias tfsnc='tfs -no-color'
alias tfss='t state show'
alias tft='t taint'
alias tftm='tft -module'
alias tu='t force-unlock -force'
alias tfu='t init -upgrade'
alias tfunlock='tu'
alias tfut='t untaint'
alias tv='t validate'
alias tval='tv'
alias tfv='t version'
alias which_resources="gg -E '^(resource|data) \"' | sed -Ee 's/.*:(resource|data) \"(.*)\".*/\2/g' -e 's/\".*//g' | suniq"
##########################
# Travis CI CLI
##########################
# See also: sensitive aliases in .env for encrypting common values.
alias te='travis encrypt'
alias tmo='travis monitor'
##########################
# Vagrant
##########################
alias vg='vagrant'
alias vgd='vg destroy'
alias vgdown='vgs'
alias vggs='vg global-status'
alias vgr='vg reload'
alias vgs='vg suspend'
alias vgu='vg up'
alias vgup='vg up'
alias vgupp='vg up --provision'
##########################
# Webpack
##########################
alias webpack='yarn webpack'
alias yw='yarn webpack'
##########################
# Yarn
##########################
alias y='yarn'
alias ya='yarn add'
alias yb='yarn build'
alias ye='yarn execute'
alias yet='yarn e2e-tests'
alias yf='yarn fix'
alias yit='yarn integration-tests'
alias yl='yarn lint'
alias ylt='yarn lint && yarn test'
alias yp='yarn publish'
alias yt='yarn test'
alias yut='yarn unit-tests'
##########################
# zsh
##########################
alias u='source ~/.zshrc && echo zsh configuration reloaded'