/
.zsh_aliases
110 lines (98 loc) · 3.22 KB
/
.zsh_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
#!/usr/bin/env zsh
# shellcheck shell=bash
alias a='ack'
alias ag='rg -g "!yarn.lock"'
alias battery='pmset -g batt'
alias bc='bc -l'
alias be='bundle exec'
alias bx='bundle exec'
alias cat='bat'
alias chomp="tr -d '\n'"
alias copy_hash='git rev-parse HEAD | pbcopy'
alias cpan='perl -MCPAN -e shell'
alias ducks='du -cks * |sort -rn |head -11'
alias e='code'
alias eamcs='emacs -nw'
alias fn='fd'
alias gdmno='git diff main --name-only'
alias gdp='git diff HEAD~'
alias glohead='git log --oneline --decorate -20'
alias gpmm="git pull origin master && git merge master"
alias gshow='git show --stat --pretty=format:"%C(yellow)%h%C(reset) %G? %C(bold blue)%an%C(reset) %s%C(bold cyan)%d%C(reset) %C(green)%cr.%C(reset) %n%n%b%n%N%-%n"'
alias guid='mysql -u root -e"select uuid();"'
alias guncommit='git reset --soft HEAD^'
alias ls='exa -bG'
alias la='exa -abG --git --icons'
alias ll='exa -labG --git --icons'
alias lt='exa -abG --tree'
alias mkdir='mkdir -p'
alias mine='rubymine'
alias more='more -r'
alias now='ruby -e "puts Time.now.utc.to_i"'
alias python='bpython'
alias rlc='rake log:clear'
alias screensaver='open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app'
alias srspec='bundle exec spring rspec'
alias ss='screensaver'
alias timestamp='ruby -e "puts Time.now.strftime(\"%FT%T%:z\")"'
alias unixtime='ruby -e "puts Time.now.utc.to_i"'
alias uuid='python -c "import uuid; print uuid.uuid4()"'
alias weather='curl http://wttr.in/sf'
alias xargscode='xargs -o code'
# function to avoid spambots scraping the email address
function joegrossberg {
USER=joegross
DOMAIN=joegrossberg.com
ssh $USER"@"$DOMAIN;
}
# Make directory and change into it.
function mcd() {
mkdir -p "$1" && cd "$1";
}
# Quickly find process info matching a string
function psgrep() {
ps axu | grep -v grep | grep "$@" -i --color=auto;
}
# Complete g like git
compdef g=git
# other git ones
function fixup() { # non-interactive rebase of the previous two commits
git reset --soft HEAD~${1} && git commit --amend -C HEAD;
};
function gitbranch {
git checkout -b "$1";
git push -u origin "$1";
}
function git_delete_merged_branches {
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
}
alias gitlog="git lg"
# Found here: https://github.com/mattsacks/dotfiles/blob/master/zshrc
function ffind() {
find . -type f -iname "*${1}*";
}
function pbcat() {
cat ${1} | pbcopy
}
function reset_colors() {
echo -ne "\033[0m";
}
function tgz() {
tar -pcz ${1} > ${1}.tgz
}
function lb() {
emacs ~/dotfiles-for-portable-configuration/logbook/$(date '+%Y-%m-%d').md
}
function lint_and_test() {
eslint_d --cache . ;
eslint_d --quiet --cache --fix --debug . > /dev/null ;
npm run test:no-migrations
}
# Found here: https://github.com/sapegin/dotfiles/blob/master/zsh/aliases.zsh
cdf() { cd "`osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)'`"; }
alias get="curl -O -L"
alias gist-paste="gist --private --copy --paste --filename" # gist-paste filename.ext -- create private Gist from the clipboard contents
alias gist-file="gist --private --copy" # gist-file filename.ext -- create private Gist from a file
if [[ -a ~/.zsh_work_aliases ]]; then
source ~/.zsh_work_aliases
fi