-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
107 lines (83 loc) · 2.76 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
#!/bin/bash
# Reload the shell (i.e. invoke as a login shell)
alias rs="source ~/.zshrc"
alias v='vim'
alias n='nvim'
alias vimrc='vim ~/.vimrc'
# Get macOS Software Updates, and update Homebrew and it's packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup'
alias brewup='brew update; brew upgrade; brew cleanup'
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'
## git
alias g="git"
alias gco="git checkout"
alias gcb="git checkout -b"
alias gb="git branch"
alias ga="git add"
alias gai="git add --patch --interactive"
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gd="git diff"
alias gdc="git diff --cached"
alias gl="git pull"
alias glr="git pull --rebase"
alias gf="git fetch"
alias gp="git push"
alias gs="git status -sb"
alias gcp="git cherry-pick"
alias gg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci)%Creset %C(cyan)%an%Creset' --abbrev-commit --date=relative"
alias ggs="gg --stat"
alias gsl="git shortlog -sn --no-merges"
alias gw="git whatchanged"
alias gchurn="git log --pretty="format:" --name-only | grep -vE '^(vendor/|$)' | sort | uniq -c | sort"
alias gcherry="git log --left-right --graph --cherry-pick --oneline" # master...feature
## python
alias ca='conda activate'
## node
# alias dev='nodemon index.js | pino-pretty'
alias ys='yarn start'
alias d='docker'
alias dc='docker compose'
# k8s
alias k='kubectl'
alias kcg='k config get-contexts'
## go
alias gorun='go run -mod=vendor'
alias gobuild='go build -mod=vendor'
## rust
alias gocargo='go build && go run'
alias cb='cargo build'
alias cr='cargo run'
## docker
alias d='docker'
alias tf='terraform'
# grep helpers - although mostly use ag these days
alias gr="grep -Irn --color --exclude-dir 'node_modules' --exclude-dir '.git'"
alias gri='gr -i'
alias pull="g prr"
## NETWORKING
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
# Show active network interfaces
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
# View HTTP traffic
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
## navigation to common dirs
alias dotfiles='cd ~/dotfiles'
## functions below, but keeping in aliases is simpler org wise
git-prune() {
git checkout master; git pull;
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
git pr-clean
}
git-refresh() {
git checkout master; git pull;
git checkout -;
git rebase master;
}
# Recursively find and replace in files
# TODO make path optional and use current dir as default
findreplace() {
find $3 -type f -exec sed -i '' -e "s/${1}/${2}/g" '{}' \;
}