This repository has been archived by the owner on Apr 3, 2022. It is now read-only.
/
thulio.plugin.zsh
156 lines (127 loc) · 3.88 KB
/
thulio.plugin.zsh
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
function update_github () {
cd $HOME/projects/github/
for i in *
do
echo 'Updating' $i && cd $i && git up && cd -
done
cd $HOME
}
function update_vim () {
nvim -i NONE -c PlugUpdate -c quital
}
function ssh-append-key {
cat ~/.ssh/id_rsa.pub | ssh $1@$2 'cat >> .ssh/authorized_keys'
}
function setup-tunnel {
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -C2qTnN -D 8080 $1 -p ${2:-22}
}
function setup-proxy {
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -C2qTnN -L 8080:127.0.0.1:3128 $1
}
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git::\1)/'
}
maiores () {
echo $
if [ 'x'$1 = 'x' ]
then
ls -G -laGSh | head -n 10
else
ls -G -laGSh | head -n $1
fi
}
function xindent {
xmlindent -f -nbe $*
}
function clone_site {
# Usage: clone_site domains_to_keep url
wget --mirror --convert-links -w 4 $1
}
function from_timestamp {
date --date=@$1
}
function unquarentine {
find . -type f -print0 | xargs -0 xattr -d com.apple.quarantine
}
function clear_zsh_history {
## Script to accumulate unique .zsh_history entries in ~/.allhistory
(cat $HOME/.zsh_history | sed -e 's/[^;]*;//' && cat $HOME/.allhistory) | sort | uniq > $HOME/.allhistory.new
rm $HOME/.allhistory
mv $HOME/.allhistory.new $HOME/.allhistory
}
function unswap {
sudo swapoff -a && sudo swapon -a
}
function flip_the_table {
cat <<EOF
(╯°□°)╯︵ ┻━┻
EOF
}
function chillout {
cat <<EOF
┬─┬ノ( º _ ºノ)
EOF
}
function shrugs {
cat <<EOF
¯\_(ツ)_/¯
EOF
}
function lenny {
cat <<EOF
( ͡° ͜ʖ ͡°)
EOF
}
function connect_to_remote_docker {
if [ "$#" -ne 4 ]; then
echo "Usage: connect_to_remote_docker HOST_USER HOST_IP CONTAINER_USER CONTAINER_IP"
else
ssh -o ProxyCommand="ssh $1@$2 nc %h %p" $3@$4
fi
}
function create_checksums {
for i in *; do sha1sum "$i" >> sha1sums.txt; done && sha1sum -c sha1sums.txt
}
function docker_update_images {
if [[ $(uname -s) -eq "Darwin" ]]; then
docker images | grep -v REPOSITORY | grep -v none | awk '{print $1":"$2};' | xargs -n 1 docker pull
else
docker images | grep -v REPOSITORY | grep -v none | awk '{print $1":"$2};' | xargs -r -n 1 docker pull
fi
}
function pyclean {
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
}
function fix_elixir_umbrella {
for app in $(ls apps); do cd "apps/$app" && ln -sf ../../_build . && cd - ; done
}
function uuid() {
uuidgen | awk '{print tolower($0)}'
}
function tcr-elixir() {
mix test && git commit -am working || git reset --hard
}
function tcr-pipenv() {
pipenv run pytest && git commit -am working || git reset --hard
}
function tcr-make() {
make test && git commit -am working || git reset --hard
}
alias json='python -mjson.tool | pygmentize -f terminal256 -l javascript -O style=native'
alias start-redis="redis-server /usr/local/etc/redis.conf"
alias start-mongodb="mongod run --config $HOME/.mongod.conf"
alias start-mysql="sudo /usr/bin/mysqld_safe --datadir='/var/lib/mysql'"
alias pinstall="pip install -M"
alias ssh="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=120"
alias ll='ls -lh'
alias m0="mplayer -idx -volume 0"
alias shit_done="git log --author=$USER --format="-%B" --since=-30days --reverse"
if [ "$(uname -s)" = "Linux" ] ; then
# Simulate OSX's pbcopy and pbpaste on other platforms
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
alias charge_iphone='sudo usbmuxd -u -U usbmux'
fi
alias mix_format_modified="(git clean --dry-run | awk '{print $3;}' && git ls-files -m) | egrep '.ex|.exs|.eex' | xargs mix format"
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_file_bytes 1024000"