-
Notifications
You must be signed in to change notification settings - Fork 2
/
.aliases
123 lines (103 loc) · 2.63 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
# go back x directories
b() {
str=""
count=0
while [ "$count" -lt "$1" ];
do
str=$str"../"
let count=count+1
done
cd $str
}
# Extract almost any archive
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) p7zip -d $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Instant server
servedir(){
python -m SimpleHTTPServer $1
}
shutd(){
echo $((date| cut -d' ' -f 1-5 && uptime | cut -d' ' -f 3-5 | cut -d',' -f 1 ) | tr "\n" " ") >> ~/.uptime.txt
sudo shutdown -h now
}
wifi(){
sudo rfkill unblock wifi
sleep 1
sudo ifconfig wlp3s0 down
sudo macchanger -r wlp3s0
sudo ifconfig wlp3s0 up
echo Running wpa_supplicant...
sudo wpa_supplicant -c /etc/wpa_supplicant/$1.conf -i wlp3s0 -B
echo Running DHCP
sudo dhclient wlp3s0
}
# Clear terminal
alias c="clear"
alias clip="xclip -selection clipboard"
alias burn="shred -n 3 -u "
alias monitor="xrandr --output HDMI1 --mode 2560x1440 --left-of eDP1"
alias monitor2="xrandr --output LVDS1 --mode 1024x600; xrandr --output VGA1 --mode 1920x1080 --left-of LVDS1"
# Common typo
alias les="less"
# Open stdout in vim
alias vr="vim -R -"
# Pretty print json
alias json="python -mjson.tool"
# Common programs alias
alias h="fc -l -100000 | grep"
alias less="less -R"
alias ls="ls --color=auto"
alias l="ls"
alias ll="ls -lah"
alias cl="clear; ls"
alias e="emacsclient"
iptv(){
iptables -v -n --line-numbers -L $@
}
iptvs(){
ip6tables -v -n --line-numbers -L $@
}
alias alsamixer="alsamixer -c 0"
# Unlock remote luks machines
unluks() {
read -s LUKSPASS
ssh -l root $1 "echo -ne $LUKSPASS >/lib/cryptsetup/passfifo"
unset LUKSPASS
}
# Archive emails
archive() {
DEST=$(dirname ~/Vault/mail/$1)
archivemail -d 30 -o $DEST $1
}
# Add gzip header for zlib compressed files
zlibtogz(){
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - $@
}
alias treed="tree -d"
p() {
if [[ $(uname) == OpenBSD ]] then
ps aux | grep $1
else
ps -fe | grep $1
fi
}
alias d="dpkg -l | grep $1"
alias nsu="nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz"