-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash.sh
118 lines (109 loc) · 4.53 KB
/
bash.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# If not running interactively, don't do anything
# [[ $- != *i* ]] && return
#PS1='\[\e[36;1m\]>>>>>>Hi Masrkai!\[\e[0m\] \[\e[1m\]\w\n\[\e[38;5;160m\]\t\[\e[39m\][\[\e[36m\]\u\[\e[38;5;240m\]_\[\e[38;5;208m\]\H\[\e[39m\]]\$\[\e[0m\] '
#--Functions
wh() {
sudo pkill dnsmasq ; cd $HOME/Programs/airgeddon && sudo bash airgeddon.sh ; cd
}
scode(){
sudo codium --no-sandbox --user-data-dir=/home/masrkai/.config/VSCodium
}
garbage(){
sudo nix-collect-garbage -d && nix-store --optimise && pip cache purge
}
gens(){
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system && echo "to remove Gens type: sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations <Gen's-Numbers>"
}
sudophone(){
adb shell sh /sdcard/Android/data/moe.shizuku.privileged.api/start.sh
}
fixcode(){
rm -rf ~/.config/VSCodium/GPUCache/
}
fixgit(){
sudo chown -R $(whoami) .git
}
fix-arduino(){
rm -rf ~/.config/arduino-ide/GPUCache/
}
fixbrave(){
sudo rm -rf ~/.config/BraveSoftware/Brave-Browser/SingletonLock
}
fusb(){
sudo chown masrkai /dev/ttyUSB0
}
sec(){
fwupdmgr get-devices && fwupdmgr refresh && fwupdmgr get-updates && fwupdmgr update
}
#--> yt-dlp
# Function to download a playlist with a specified resolution
download-playlist() {
local resolution="${2:-1440}" # Default to 1440p if no resolution is provided
yt-dlp -f "bv[height<=${resolution}]+ba/b[height<=${resolution}]" --sleep-interval 1 --max-sleep-interval 2 --merge-output-format mp4 --download-archive download_archive.txt "$1"
}
# Function to download a single video with a specified resolution
download-video() {
local resolution="${2:-1440}" # Default to 1440p if no resolution is provided
yt-dlp -f "bv[height<=${resolution}]+ba/b[height<=${resolution}]" --sleep-interval 1 --max-sleep-interval 2 --merge-output-format mp4 --download-archive download_archive.txt "$1"
}
s() {
if [[ $# == 0 ]]; then
eval "sudo $(fc -ln -1)"
else
sudo "$@"
fi }
export FZF_DEFAULT_OPTS='
--color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9
--color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9
--color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6
--color=marker:#ff79c6,spinner:#ffb86c,header:#6272a4'
#! Extraction function
SAVEIFS=$IFS
IFS="$(printf '\n\t')"
function extract {
if [ $# -eq 0 ]; then
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz|.zlib|.cso|.zst>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
return 1
fi
for n in "$@"; do
if [ ! -f "$n" ]; then
echo "'$n' - file doesn't exist"
continue
fi
case "${n%,}" in
*.cbt|*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
if [[ "$n" == *.tar.gz || "$n" == *.tgz ]]; then
tar zxvf "$n"
else
tar xvf "$n"
fi
;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.cbr|*.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.cbz|*.epub|*.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.7z|*.apk|*.arj|*.cab|*.cb7|*.chm|*.deb|*.iso|*.lzh|*.msi|*.pkg|*.rpm|*.udf|*.wim|*.xar|*.vhd)
7z x ./"$n" ;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*.cpio) cpio -id < ./"$n" ;;
*.cba|*.ace) unace x ./"$n" ;;
*.zpaq) zpaq x ./"$n" ;;
*.arc) arc e ./"$n" ;;
*.cso) ciso 0 ./"$n" ./"$n.iso" && extract "$n.iso" && rm -f "$n" ;;
*.zlib) zlib-flate -uncompress < ./"$n" > ./"$n.tmp" && \
mv ./"$n.tmp" ./"${n%.*zlib}" && rm -f "$n" ;;
*.dmg) hdiutil mount ./"$n" -mountpoint "./$n.mounted" ;;
*.tar.zst) tar -I zstd -xvf ./"$n" ;;
*.zst) zstd -d ./"$n" ;;
*)
echo "extract: '$n' - unknown archive method"
continue
;;
esac
done
}
IFS=$SAVEIFS