-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
162 lines (143 loc) · 3.92 KB
/
.bashrc
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
157
158
159
#source /usr/share/defaults/etc/profile
#set -o vi
### Files ###
alias ls='ls --color=auto'
alias lnew='ls --color=auto -tc -G -h'
alias c='clear'
alias cc='clear && ls -a'
alias ..='cd ..'
function cd
{
builtin cd "$@" && clear && ls -a
}
alias eee='exit'
alias mv='mv -i "$@"'
alias rm='rm -i "$@"'
alias cp='cp -i "$@"'
alias whereis='find . -name "$@"'
alias img='sxiv "$@"'
alias cl='cd ~/Documents/college/'
alias note='/usr/local/bin/note "$@"'
### Applications ###
alias pp='python3 "$@"'
alias o='nautilus --no-desktop --new-window . &'
alias pdf='clear; evince &'
alias gstat='git status'
alias ff='firefox -no-remote -P &'
alias n='clear; node ~/Documents/notify_nyc/index.js | less -R'
alias op='xdg-open &>/dev/null'
alias img_clean='exiftool -all= -overwrite_original "$@"'
alias me='ip r'
alias loc='git ls-files | xargs cat | wc -l'
alias locls='git ls-files | xargs wc -l'
alias vid='ls -ct ~/Videos/ | dmenu -i -l 15 -fn 'Hack-30' | xargs -I {} mpv ~/Videos/{} &'
alias r='ranger'
alias img='xsiv -f '
### Others ###
alias m='echo "####################################################"'
alias temp='cd $(mktemp -d /tmp/deleteme-XXX)'
alias grep='grep --color=auto $"@"'
alias godmode='sudo -E su --preserve-environment'
export EDITOR=vim
export VISUAL=vim
function mac
{
sudo echo "-Turning off wifi"
nmcli networking off
echo "-Waiting a second"
sleep 1
echo "-Changing mac to original address"
sudo macchanger -p wlp1s0
echo "-Changing mac to similar random address"
sudo macchanger -a wlp1s0
echo "-Turning on wifi"
nmcli networking on
}
# https://superuser.com/a/611582
function countdown(){
clear;
date1=$((`date +%s` + $1));
while [ "$date1" -ge `date +%s` ]; do
echo -ne "$2 $(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r";
sleep 0.1
done
clear;
}
function stopwatch(){
clear;
date1=`date +%s`;
while true; do
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
sleep 0.1
done
clear;
}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
setxkbmap -option caps:swapescape
function get_feed()
{
curl -s -L "$1" | sfeed_web "$1"
}
function upgo()
{
sfeed_update
mkdir -p $HOME/.sfeed/frames
builtin cd $HOME/.sfeed/frames
sfeed_frames $HOME/.sfeed/feeds/*
builtin cd $OLDPWD
firefox $HOME/.sfeed/frames/index.html
}
function gset()
{
git init
git config --list
echo "git config --local user.name dxwc"
git config --local user.name dxwc
echo "git config --local user.email dxwc@users.noreply.github.com"
git config --local user.email dxwc@users.noreply.github.com
}
function save()
{
cd $(mktemp -d /tmp/deleteme-XXX)
wget -d -nv --html-extension -r -l 1 --convert-links --adjust-extension --page-requisites --no-parent --span-hosts --user-agent="" "$@"
rm -rf ~/.wget-hsts
}
function save_bare()
{
cd $(mktemp -d /tmp/deleteme-XXX)
wget -d -nv --html-extension --convert-links --adjust-extension --page-requisites --no-parent --span-hosts --convert-links --timestamping --no-host-directories --user-agent="" "$@"
rm -rf ~/.wget-hsts
}
PATH=/opt/waterfox/:"$PATH"
u_name=""
if [ "$(whoami)" == "root" ]; then
u_name="ROOT "
fi
PS1="[$u_name\w] "
trim()
{
#https://stackoverflow.com/a/1683850
local trimmed="$1"
trimmed="${trimmed## }"
trimmed="${trimmed%% }"
echo "$trimmed"
}
define()
{
# npm install -g unfluff
curl --user-agent "" --silent "https://www.vocabulary.com/dictionary/$(trim $@)" | unfluff | node ~/scripts/stdin_define_json_parse.js
}
rmc()
{
if [[ -d ~/.cache ]]; then
cd ~/.cache/
ls --hide=thumbnails . | xargs rm -rf
cd -
clear
echo "Cleaned, ls ~/.cache : $(ls ~/.cache)"
else
echo "Directory ~/.cache doesn't exist"
fi
}