-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_aliases
112 lines (106 loc) · 2.7 KB
/
.bash_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
#!/bin/bash
##########################################################################
# EXPORTS
#
export PATH=$PATH:~/.local/bin/
##########################################################################
# COMMON
#
for f in ~/.bash_scripts/*; do source $f; done
alias :q=exit
alias ll="ls -lrth"
alias watchc="watch --color"
alias whatismyip="curl ifconfig.me"
alias whereami='printf "$(curl -s ifconfig.co/city), $(curl -s ifconfig.co/country) {$(curl -s curl ifconfig.me)}"'
alias copy="xclip -selection clipboard"
alias wut="fortune | cowsay | lolcat"
alias grep_cheat="curl cheat.sh/grep"
alias gohere='cd $HERE'
alias here='HERE=$(pwd)'
alias s='status'
alias o='xdg-open'
mkcd(){
mkdir $@
cd $@
}
status(){
task
gitlist
}
cheat(){
curl cheat.sh/$1
}
grep_code(){
grep -rnw . -e "$@" --exclude-dir={node_modules,venv}
}
grep_code_filename(){
grep -rnwl . -e "$@" --exclude-dir={node_modules,venv}
}
findfile(){
find . -path ./node_modules -prune -o -name $1 -print
}
helpa(){
cat ~/.bash_scripts/*${1}*
}
complete -W "$(ls ~/.bash_scripts/)" helpa
senv(){
set -a
source $1
set +a
}
##########################################################################
# BASH_ALIASES RELATED
#
alias sa="source ~/.bash_aliases"
alias realias="curl -X GET https://raw.githubusercontent.com/joeyism/.files/master/.bash_aliases > ~/.bash_aliases && source ~/.bash_aliases"
alias diffa="vimdiff <(curl -sL https://raw.githubusercontent.com/joeyism/.files/master/.bash_aliases) ~/.bash_aliases"
ea(){
_check_no_args_quiet $1
if [ $? = 1 ]; then
vim ~/.bash_aliases
else
vim ~/.bash_scripts/$1
fi
}
complete -W "$(ls ~/.bash_scripts/)" ea
updatea(){
for file in $(git status --porcelain | awk 'match($1, "M"){print " " $2}')
do
git add $file
done
git commit -m "update"
git push origin master
}
wgeturl(){
url=$1
_check_no_args_quiet $1
if [ $? != 0 ]
then
read -p "url: " url
fi
filename=$(echo $url | tr "?" "\n" | head -n 1 | tr "/" "\n" | tail -n 1)
wget "$url" -O $filename
}
honchome(){
githome=$(git rev-parse --show-toplevel)
envfile="$githome/.env"
honcho -e $envfile $@
}
restart-spotify(){
systemctl --user stop spotifyd.service
systemctl --user start spotifyd.service
}
firefox-extension-zip(){
packagename=$1
_check_no_args_quiet $1
if [ $? != 0 ]
then
read -p "Package Name: " packagename
fi
zip -r -FS ../$packagename.zip * --exclude '*.git*' --exclude '*.swp' --exclude '*saved.vim*'
}
firefox-extension-build(){
honcho -e ../.env run bash
web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET
honcho -e ../.env run web-ext build
}