-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
149 lines (146 loc) · 3.51 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
#!/bin/bash
###############################
# _ _ _
#/ | ___| |_(_)_ __ _ _ ___
#| |/ __| __| | '_ \| | | / __|
#| | (__| |_| | | | | |_| \__ \
#|_|\___|\__|_|_| |_|\__,_|___/
###############################
# 1ctinus dotfiles
# 2020-2021
###############################
# other files #
###############################
source /home/james/code/bash/list.sh
source /home/james/code/bash/readme.sh
source /home/james/code/bash/haiku.sh
source /home/james/code/bash/flat.sh
source /home/james/code/bash/alias.sh
###############################
# Sets manpager to neovim #
###############################
export MANPAGER="nvim -c 'set ft=man' -"
###############################
# Prompt #
###############################
PS1="\[\e[31m\]\u@\h\[\033[00m\]\[\033[01;34m\]\w\[\033[00m\]\$ "
##############################
# Commands #
##############################
function reddit {
if [ -z $1 ];
then
xdg-open https://reddit.com
elif [[ -z $2 ]];
then
xdg-open https://reddit.com/r/$1
else
xdg-open "https://reddit.com/r/$1/search?q=$2&restrict_sr=1&sort=top"
fi;
}
function extinfo {
x= curl -s https://fileinfo.com/extension/$1 | grep -o -P '(?<=<\/span>).*(?=<\/h2>)'
printf "$x"
}
function flash {
true= "true"
while :; do
for (( n = 0; n <= 255; n++ )); do
printf "$(tput setaf ${n}) $1"
sleep 0.2
printf "\r"
done
done
}
function rndo {
return $(printf "%7d" $RANDOM)
}
function lehack {
while :; do
#sleep 0.2
for (( i = 0; i <= 4; i++ )); do
printf "%016d" $(echo "obase=2; $RANDOM" | bc)
done
printf "\r"
done
}
function 1test {
chars="/-\|"
while :; do
for (( i=0; i<${#chars}; i++ )); do
sleep 0.5
# echo (-en "${chars:$i:1}" "\r")
test=$(printf "%10s");echo ${test// /(-en "${chars:$i:1}" "\r")}
done
done
}
# TODO: ADD -H to curl and make jq -r
function subsize {
size=$(curl -s https://api.reddit.com/r/"$1" | jq '.data.children[0].data.subreddit_subscribers')
printf "$size\n"
}
function wurtz {
mpv https://billwurtz.com/"$1".mp3
}
function cpp {
g++ -o "code/cpp/out/$2.out" "code/cpp/$1.cpp"
./code/cpp/out/"$2"
}
# for xterm cursor
if [[ $(printf $(ps -p $(ps -p $$ -o ppid=) o args=)) == "xterm" ]]; then echo -e -n "\x1b[\x35 q"; fi
#ictinus pack source adder
function ipsa {
sed -i "36i \"$1\": {\n\"iconPath\": \"./../images/$1.png\"\n}," "/home/$USER/.vscode/extensions/1ct-pack/fileicons/1ct-icon-theme.json"
}
function grso {
if [[ $1 == https:* ]]
then
uno="$(cut -d'/' -f4 <<<$1)"
dos="$(cut -d'/' -f5 <<<$1)"
else
uno="$(cut -d'/' -f1 <<<$1)"
dos="$(cut -d'/' -f2 <<<$1)"
fi
api="https://api.github.com/repos/$uno/$dos"
printf "$api\n"
fuck=$(curl -s $api | jq '.size')
printf "$(( fuck/1000 ))MB\n"
}
function aa {
echo "alias $1=\"$2\"" >> ~/code/bash/alias.sh
}
# Add -H for curl
function btc {
x= curl -s https://api.coindesk.com/v1/bpi/currentprice.json | jq '.bpi.USD.rate' | sed -e s/\"//g
printf "$x"
}
function search {
grep -rnw './' -e "$1" --exclude-dir=node_modules --exclude-dir=.git
}
function vimalias {
printf "\ncnoreabbrev $1 e $2" >> ~/.config/nvim/init.vim
}
function def {
xdg-open https://en.wiktionary.org/wiki/"$1"
}
function chkfile {
FILE=$1
if [ -f $FILE ]; then
echo "File $FILE exists."
else
echo "File $FILE does not exist."
fi
}
function jazz {
while :; do
mpv "https://billwurtz.com/$(shuf -n 1 ~/code/bash/jazz.txt).mp3"
done
}
function loop {
while :; do
song="$(shuf -n 1 ~/code/bash/wurtz.txt)"
clear
echo -e "$song\n"
mpv "https://billwurtz.com/${song}.mp3"
done
}