10 Revīzijas 12ed88f304 ... 5889dd16b7

Autors SHA1 Ziņojums Datums
  bfgeshka 5889dd16b7 desktop_graphics.sh 5 mēneši atpakaļ
  bfgeshka c93920f3b1 megasync.sh 5 mēneši atpakaļ
  bfgeshka 40ed7457b6 nas-remount upd 5 mēneši atpakaļ
  bfgeshka 59f5f6bb2e dmenuconf upd 5 mēneši atpakaļ
  bfgeshka 2ee5ac628a vpngate_scrapper.py 5 mēneši atpakaļ
  bfgeshka b5edd917d2 audiostart-pulse 5 mēneši atpakaļ
  bfgeshka dd44b0a41c torrent_service 9 mēneši atpakaļ
  bfgeshka bfefb3dcd4 :) 9 mēneši atpakaļ
  bfgeshka 0da83df1f1 convert_to_webp.sh 9 mēneši atpakaļ
  bfgeshka 937485ef5c dmenuconf upd 9 mēneši atpakaļ

+ 27 - 0
ishell/audiostart-pipewire.sh

@@ -0,0 +1,27 @@
+#! /bin/sh
+
+SUDOCMD=doas
+
+killall pipewire-pulse
+killall pipewire
+
+pipewire &
+sleep 1
+pipewire-pulse &
+wireplumber &
+sleep 1
+
+pidpp=`pidof -s pipewire-pulse`
+pidpw=`pidof -o $pidpp -s pipewire`
+pidwp=`pidof -s wireplumber`
+
+$SUDOCMD renice -n -10 -p $pidpw
+$SUDOCMD renice -n -10 -p $pidwp
+$SUDOCMD renice -n -10 -p $pidpp
+
+$SUDOCMD ionice -c 1 -n 1 -p $pidpw
+$SUDOCMD ionice -c 1 -n 1 -p $pidwp
+$SUDOCMD ionice -c 1 -n 1 -p $pidpp
+
+
+exit 0

+ 19 - 0
ishell/convert_to_webp.sh

@@ -0,0 +1,19 @@
+#! /bin/sh
+
+read -p "Continue (y/n)? " choice
+case "$choice" in
+	y|Y ) echo "yes" ;;
+	n|N ) echo "no" && exit 0 ;;
+	* ) echo "invalid" && exit 1 ;;
+esac
+
+# Convert all the PNG and JPEG files to WebP format with 75 quality lossy compression
+# Then delete all the unused JPEG/PNG files
+find ./ -type f -name '*.png' -exec sh -c 'cwebp -q 80 $1 -o "${1%.png}.webp" && rm "${1}"' _ {} \;
+find ./ -type f -name '*.jpg' -exec sh -c 'cwebp -q 80 $1 -o "${1%.jpg}.webp" && rm "${1}"' _ {} \;
+find ./ -type f -name '*.jpeg' -exec sh -c 'cwebp -q 80 $1 -o "${1%.jpeg}.webp" && rm "${1}"' _ {} \;
+find ./ -type f -name '*.gif' -exec sh -c 'cwebp -q 80 $1 -o "${1%.gif}.webp" && rm "${1}"' _ {} \;
+
+# find ./ -type f -name '*.jpg' -delete ;
+# find ./ -type f -name '*.jpeg' -delete ;
+# find ./ -type f -name '*.png' -delete ;

+ 34 - 0
ishell/desktop_graphics.sh

@@ -0,0 +1,34 @@
+#! /bin/sh --posix
+
+xrdb -merge ~/.Xresources
+
+killall shadow
+killall input_lemonbar
+killall lemonbar
+killall xcompmgr
+
+sleep 1
+
+ALLMONITORLENGTH=`xrandr | grep "*" | sed -e 's/x.*$//g' | paste -sd+ - | bc`
+
+input_lemonbar -c0 "#161712" -c1 "#e2e1cf" -c2 "#c7c4b1" -c3 "#6e6f67" -c4 "#282b25" -c5 "#868377" -c6 "#cc7777" | lemonbar -b -g "$ALLMONITORLENGTH"x12 -d -f "-lucy-tewii-medium-r-normal--11-90-100-100-c-60-iso10646-1" -f "-*-terminus-*-*-*-*-*-*-*-*-*-*-*-*" -p -a 32 | mksh &
+
+
+mode_fast ()
+{
+	hsetroot -solid \#352f2f -tile "$HOME/.config/desktop/wallpaper"
+}
+
+mode_fancy ()
+{
+	mode_fast
+	cd ~/bin/git/shadow
+#	poetry run ./shadow -o 0.5 -m root -f 30 -q 0.3 ---qualitymode pixelize ./glsl/compressed_sin.glsl &
+	xcompmgr -c &
+}
+
+case "$1" in
+	"fast" ) mode_fast ;;
+	"fancy" ) mode_fancy & ;;
+	*) exit 1 ;;
+esac

+ 47 - 0
ishell/megasync.sh

@@ -0,0 +1,47 @@
+#! /usr/bin/env sh
+
+getremotefile()
+{
+	localtmpdir="$(mktemp -d -p $1)"
+	localtmpfile="${localtmpdir}/${3}"
+	localfile="${1}/${3}"
+	backupfile="${localfile}_backup_$(date)"
+	megaget --no-progress --path "$localtmpfile" "$2" && echo "Downloaded $2 successfully!"
+	mv "$localfile" "$backupfile" && mv "$localtmpfile" "$localfile" && echo "Synced and replaced successfully!"
+}
+
+sendremotefile()
+{
+	megarm "$1"
+	megaput --no-progress --path "$1" "$2" && echo "Uploaded $1 successfully!"
+}
+
+# CONFIG
+SYNCEDDIR=~/docs
+SYNCEDFILE=base_ultimate.kdbx
+REMOTEFILEPATH=/Root/sync/base_ultimate.kdbx
+THRESHOLDINSECONDS=7200 # 2h difference
+# CONFIG
+
+test ! -d $SYNCEDDIR && echo "Synced path doesn't exist, quitting..." && exit 1
+
+REMOTEFLINE="$(megals -l --reload | grep "$REMOTEFILEPATH")"
+test -z "$REMOTEFLINE" && echo "Failed to get remote file stat, quitting..." && exit 2
+REMOTEDATE="$(echo "$REMOTEFLINE" | awk '{ print $5, $6 }')"
+LOCALFLINE="$(stat -c %y "${SYNCEDDIR}/${SYNCEDFILE}")"
+test -z "$LOCALFLINE" && "Failed to get local file stat, quitting..." && exit 3
+LOCALDATE="$(stat -c %y "${SYNCEDDIR}/${SYNCEDFILE}" | sed -e 's/\..*//g')"
+
+echo "Remote: ${REMOTEDATE}"
+echo "Local: ${LOCALDATE}"
+
+DIFFSECONDS=$(echo "$(($(date -d "$REMOTEDATE" +%s) - $(date -d "$LOCALDATE" +%s)))")
+ABSDIFFSECONDS=$DIFFSECONDS
+test $ABSDIFFSECONDS -lt "0" && ABSDIFFSECONDS=$(echo "$ABSDIFFSECONDS * -1" | bc -l)
+test $ABSDIFFSECONDS -lt $THRESHOLDINSECONDS && echo "Remote and local are close enough in time (${DIFFSECONDS}s), exitting..." && exit 0
+
+echo "Local and remote are too far apart (${DIFFSECONDS}s), syncing..."
+test $DIFFSECONDS -lt "0" && echo "Remote is too old!" && sendremotefile "$REMOTEFILEPATH" "${SYNCEDDIR}/${SYNCEDFILE}"
+test $DIFFSECONDS -gt "0" && echo "Local is too old!" && getremotefile "$SYNCEDDIR" "$REMOTEFILEPATH" "$SYNCEDFILE"
+
+exit 0

+ 11 - 7
ishell/nas-remount

@@ -2,16 +2,20 @@
 
 source ~/.config/secretsrc
 
-sudo umount -lf /mnt/curl
-sudo umount -lf /mnt/volb
-sudo killall curlftpfs
-
+SUDOCMD=doas
 
 IPADDR=192.168.88.4
-MNT_OPT="noatime,nolock,defaults,rsize=4096,wsize=4096,vers=3"
+MNT_OPT="noatime,nolock,defaults,rsize=8192,wsize=8192,vers=3"
 # MNT_OPT="hard,nofail,noatime,nodiratime,timeo=10,retrans=1,retry=1,nolock,nfsvers=3,proto=udp,_netdev"
 
-sudo curlftpfs -o nonempty,allow_other $SECRET_FTP_AUTH@$IPADDR /mnt/curl
-sudo mount.nfs $IPADDR:/shares/volb /mnt/volb -v -o $MNT_OPT
+if [ "$1" = "hard" ]
+then
+	$SUDOCMD umount -lf /mnt/curl
+	$SUDOCMD umount -lf /mnt/volb
+	$SUDOCMD mount.nfs4 $IPADDR:/shares/volb /mnt/volb -v -o $MNT_OPT
+fi
+
+$SUDOCMD killall curlftpfs
+$SUDOCMD curlftpfs -o nonempty,allow_other $SECRET_FTP_AUTH@$IPADDR /mnt/curl
 
 exit 0

+ 5 - 0
ishell/steam-you-pig.sh

@@ -0,0 +1,5 @@
+#! /bin/sh
+
+sudo find /dev/shm -name "u100*" -delete
+
+exit 0

+ 33 - 0
ishell/torrent-service

@@ -0,0 +1,33 @@
+#! /bin/sh
+
+UPUSER=`pgrep xinit | xargs ps -o uname= -p`
+source /home/$UPUSER/.profile
+
+TMCONFIGPATH_NRM=/home/$UPUSER/.config/transmission-daemon
+TMCONFIGPATH_AUX=/home/$UPUSER/.config/transmission-daemon_no-manual
+
+try_run()
+{
+	[[ $TORPART == $TORPART_NRM ]] && nohup transmission-daemon -g $TMCONFIGPATH_NRM && echo "Transmisson (normal) is starting..."
+	[[ $TORPART == $TORPART_AUX ]] && nohup transmission-daemon -g $TMCONFIGPATH_AUX && echo "Transmisson (auxilliary) is starting..."
+
+	transmission-remote -U
+	transmission-remote -D
+
+	return 0
+}
+
+cycle()
+{
+	[[ -n `ifconfig tun0 | grep -q "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00"` ]] && echo "[`date`] VPN isn't up" && return 0
+	[[ -n `pgrep transmission` ]] && echo "[`date`] Transmission is already running, skipping..." && return 0
+	try_run ""
+}
+
+while :
+do
+	cycle ""
+	sleep 180s
+done
+
+exit 0

+ 59 - 0
ishell/vpngate_scrapper.py

@@ -0,0 +1,59 @@
+#!/usr/bin/env python3
+
+import os
+import csv
+import urllib.request
+import base64
+import datetime
+
+
+serversnum = 50
+mirrorlist = [ "https://www.vpngate.net", "http://5.181.235.14:29916", "http://88.218.17.24:20261", "http://138.199.46.86:36667", "http://109.111.243.206:17579", "http://78.142.193.246:33304", "http://163.182.174.159:18358", "http://91.193.75.5:45082", "http://103.201.129.226:14684", "http://146.70.205.2:6283", "http://146.70.205.6:34299", "http://62.133.35.246:2265" ]
+reqpart = "/api/iphone/"
+# listurl = "http://www.vpngate.net/api/iphone/"
+ovpndirdir = "~/docs/ovpn"
+ovpnpath = "/tmp/profile.ovpn"
+fmtstrhead = "{:^4} | {:^4} | {:^4} | {:^30} | {:^10}"
+fmtstr     = "[{:>2}] |  {}  | {:>4} | {:<30} | {:^10}"
+scriptdir = os.path.expanduser("~/.config/openvpn")
+
+def save_ovpn_file(reader, index, path):
+    current = reader.__next__()
+    fpath = "%s/[#%02d]_[%s][P%03d]_%s.ovpn" % (path, index, current[6], int(current[3]), current[0])
+    with open(fpath, 'w') as f:
+#    with open("%s/[#%d][P%s path + "/[#" + str(index) + "][P:" + current[0] + ".ovpn", 'w') as f:
+            f.write(base64.b64decode(current[14]).decode('ascii'))
+            f.write( "script-security 2\n" )
+            f.write( "up \"" + scriptdir + "/up.sh\"\n" )
+            f.write( "down \"" + scriptdir + "/down.sh\"\n" )
+            f.write( "data-ciphers 'AES-128-CBC:AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305'\n" )
+
+## Mirror selection
+# fmtmirr   = "[{:3}] | {:>40}"
+# for i in range(len(mirrorlist)):
+#     print(fmtmirr.format( i, mirrorlist[i] ))
+
+mirchoice = 0
+# while mirchoice < 0 or mirchoice > (len(mirrorlist) - 1):
+#     mirchoice = int(input("Select a mirror:: "))
+
+listurl = mirrorlist[mirchoice] + reqpart
+response = urllib.request.urlopen(listurl).read().decode('utf-8').split('\n')
+reader = csv.reader(response, delimiter=',')
+
+# Get rid of irrelevant headers
+reader.__next__()
+reader.__next__()
+
+dirpath = os.path.expanduser(ovpndirdir) + "/" + datetime.datetime.now().strftime("%Y-%m-%d_%H_%M")
+if not os.path.exists(dirpath):
+    os.makedirs(dirpath)
+
+for i in range(serversnum):
+    save_ovpn_file(reader, i, dirpath)
+
+#print(fmtstrhead.format( "INDX", "LCTN", "Ping", "Server ID", "Score" ))
+#for i in range(serversnum):
+#    current = reader.__next__()
+#    print(fmtstr.format( i, current[6], current[3], current[0], current[2] ))
+#    profiles.append(current[14])

+ 13 - 8
menu/dmenuconf

@@ -16,21 +16,26 @@ SHELLDIRLIST=$(ls -1 $SHELLDIRPATH)
 DLIST="\
 maim selection
 scrot selection
+ardour8
+audacious
+bfm
+claws-mail
 geany
+keepassxc
 lxappearance
 lxrandr
-ardour8
+obs
 pcmanfm
+picunic-gui
+qpwgraph
+reaper-launch.sh
+retroarch
 spacefm
 st
-bfm
+steam
 zoom
-qjackctl
-obs
-picunic-gui
-audacious
-keepassxc
-reaper-launch.sh
+samrewritten
+easyeffects
 "
 
 APPLIST="\