-
Notifications
You must be signed in to change notification settings - Fork 15
/
aliases
155 lines (119 loc) · 3.25 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
########
# Core #
########
alias mkdir='mkdir -p'
alias grep='grep --color=always'
alias ls='ls --color=always'
alias l='ls -lh' # Lists human readable sizes.
alias ll='l -A' # Lists human readable sizes, hidden files.
alias lr='l -R' # Lists human readable sizes, recursively.
alias lt='l -tr' # Lists sorted by date, most recent last.
###########
# Udiskie #
###########
alias um='udiskie-mount --recursive --options noatime'
alias uu='udiskie-umount'
alias up='um --password-prompt "builtin:tty"'
#######
# Git #
#######
# Ripped from Prezto
# https://github.com/sorin-ionescu/prezto/tree/master/modules/git
function git-branch-current {
if ! command git rev-parse 2> /dev/null; then
print "$0: not a repository: $PWD" >&2
return 1
fi
local ref="$(command git symbolic-ref HEAD 2> /dev/null)"
if [[ -n "$ref" ]]; then
print "${ref#refs/heads/}"
return 0
else
return 1
fi
}
alias g='git'
alias gb='git branch'
alias gc='git commit --verbose'
alias gco='git checkout'
alias gia='git add'
alias gm='git merge'
alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"'
alias gwR='git reset --hard'
alias gwd='git diff --no-ext-diff'
alias gwr='git reset --soft'
alias gws='git status --short'
#############
# Git Annex #
#############
alias gx='git annex'
alias gxa='git annex add'
alias gxs='git annex sync'
alias gxg='git annex get'
alias gxd='git annex drop'
alias gxc='git annex copy'
alias gxe='git annex edit'
gxurl() {
REPO="${1:-$HOME/documents}"
less "$REPO"/.git/annex/url
}
###############
# Taskwarrior #
###############
alias t='task'
alias ta='task add'
alias tm='task modify'
alias to='taskopen'
alias ti='task add due:tomorrow tag:inbox'
tn() {
if ! taskopen -a $1; then
task annotate notes $1
taskopen -a $1
fi
}
##########
# Pacman #
##########
alias pacx="sudo pacman --remove"
alias pacX="sudo pacman --remove --nosave --recursive"
############
# My Repos #
############
alias lmr='mr --config $HOME/library/src/myrepos.conf --directory=$HOME/library/src'
alias wmr='mr --config $HOME/projects/tad/docs/config/myrepos.conf --directory=$HOME/projects/tad'
alias pmr='mr --config $HOME/projects/.mrconfig --directory=$HOME/projects'
########
# Pass #
########
alias cplogin='sed -n "/^login/Is/login:\s\+//p" | xsel -ib'
alias cpurl='sed -n "/^url/Is/url:\s\+//p" | xsel -ib'
_pw() {
local characters="${1}" length="${2:-25}"
bash -c 'read -r -n "$0" pass < <(LC_ALL=C tr -dc "$1" < /dev/urandom) && echo $pass' $length $characters
}
alias pw='_pw "[:graph:]"'
alias pw:a='_pw "[:alnum:]"'
alias pw:d='_pw "[:digit:]"'
########
# Misc #
########
alias mtr-report='mtr --report --report-cycles 10 --no-dns'
alias e='aunpack'
alias http-serve='python -m http.server'
alias bc='bc -lq'
alias utc='env TZ="UTC" date'
iowaiting() {
watch -n 1 "(ps aux | awk '\$8 ~ /D/ { print \$0 }')"
}
def() {
dict $1 | less
}
jul () {
date -d "$1-01-01 +$2 days -1 day" "+%Y-%m-%d";
}
recordmywindow () {
recordmydesktop --no-sound --windowid $(xwininfo | grep "Window id" | awk '{print $4;}')
}
cheat() {
curl --location --silent "cheat.sh/$1?style=default" | ${PAGER:-less};
}