-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextra.sh
executable file
·98 lines (82 loc) · 1.82 KB
/
extra.sh
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
#!/bin/zsh
#
# MY
# CUSTOM
# FUNCTIONS
#
# randomize color prompt
PS1_ORIGINAL=$PS1
function rand_prompt() {
#PROMPT="%F{$((1+RANDOM%255))}>%f "
PS1="\[\e[38;5;$((RANDOM%256+1))m\]$PS1_ORIGINAL\[\e[0m\] "
}
# randomize background color
function rand_bg() {
convert -size 100x100 xc:#990000 $BG_PATH #generate image
#sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '$BG_PATH'" && killall Dock
}
function fill() {
python3 -c "import shutil; print('$1'*shutil.get_terminal_size().columns)"
}
# indent a multiline command
function indent() {
if [ ! -z "$1" ]
then prefix="$1"
else prefix="- "
fi
while read input; do
echo "${prefix}${input}";
done
}
function mute() {
$@ > /dev/null 2>&1
}
# set terminal theme
theme_config=~/.config/kitty/theme.conf
function theme() {
rm ~/.config/kitty/theme.conf
wget "https://raw.githubusercontent.com/dexpota/kitty-themes/master/themes/$1.conf" -O "$theme_config"
echo "press '⌃+⌘+,' to reload theme"
}
function geet() {
if [ -z "$1" ]; then git pull; return; fi
git clone "[email protected]:LeonKuhne/$1.git"
c "$1"
}
function goot() {
git add .
git commit -m "get oot"
git push
}
function browse() {
if [ -z $1 ]; then
echo "usage: browse <url>"
return
fi
open -a $BROWSER -g "$1"
open -a $BROWSER # focus the window
}
# search the internet
function goo() {
url=$(echo "$@" | jq -sRr @uri)
url="https://www.google.com/search?q=$url"
browse $url
}
# navigate with ranger
function nav() {
bash -c "ranger $@ --choosedir=$LWD_DIR"
back
}
function notes() {
cat .notes
}
function note() {
echo "$(date '+%H:%M %m/%d') $@" >> .notes
tail -n 5 .notes
}
function post() {
curl \
--location --request POST "$1" \
--header 'Content-Type: application/json' \
--data-raw "$2"
}