Added all changes since last year
This commit is contained in:
		
							parent
							
								
									dccfecec74
								
							
						
					
					
						commit
						a101b152eb
					
				
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| *.log | ||||
| *.old | ||||
| *.swp | ||||
| __pycache__ | ||||
| temp | ||||
| @ -1,6 +1,10 @@ | ||||
| # Script collection by lanxu :muscle: | ||||
| This is a general collection of useful scripts used by me. Most of the scripts are written or modified by me. | ||||
| 
 | ||||
| ## Disclaimer | ||||
| 
 | ||||
| Totally out-of-date. Will be updated in the future! | ||||
| 
 | ||||
| ## Scripts by others | ||||
| 
 | ||||
| Script       | Description | ||||
| @ -40,4 +44,3 @@ There are a few scripts that are just thrown into the mix in case I need them at | ||||
| 
 | ||||
| convertAtlasXMLToJson.php (convert sprite atlases to json) | ||||
| sortPackagesBySize.sh (pacman script to sort packages by used size) | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										10
									
								
								applications/itchio.desktop
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								applications/itchio.desktop
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| [Desktop Entry] | ||||
| Type=Application | ||||
| Name=itch (XWayland) | ||||
| Exec=env GDK_BACKEND=x11 itch %U | ||||
| Icon=itch | ||||
| Terminal=false | ||||
| Categories=Game; | ||||
| MimeType=x-scheme-handler/itchio;x-scheme-handler/itch; | ||||
| X-GNOME-Autostart-enabled=true | ||||
| Comment=Install and play itch.io games easily (uses X11 for games) | ||||
							
								
								
									
										8
									
								
								applications/lf_terminal.desktop
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								applications/lf_terminal.desktop
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| [Desktop Entry] | ||||
| Type=Application | ||||
| Name=lf-terminal | ||||
| Comment=Launches the lf file manager | ||||
| Icon=utilities-terminal | ||||
| Exec=kitty -e lf | ||||
| Categories=System;FileTools;FileManager | ||||
| MimeType=inode/directory; | ||||
							
								
								
									
										9
									
								
								applications/mullvad-vpn.desktop
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								applications/mullvad-vpn.desktop
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| [Desktop Entry] | ||||
| Name=Mullvad VPN (XWayland) | ||||
| Exec=env GDK_BACKEND=x11 "/opt/Mullvad VPN/mullvad-vpn" %U | ||||
| Terminal=false | ||||
| Type=Application | ||||
| Icon=mullvad-vpn | ||||
| StartupWMClass=Mullvad VPN | ||||
| Comment=Mullvad VPN client | ||||
| Categories=Network; | ||||
							
								
								
									
										11
									
								
								attic/btpower.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								attic/btpower.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| DEVICES=$(upower -e) | ||||
| 
 | ||||
| for device in $DEVICES; do | ||||
| 	info=$(upower -i $device) | ||||
| 	echo "$info" | ||||
| 	model=$(echo "$info" | grep -oP 'model: \K\w+[a-zA-Z0-9 ]*$') | ||||
| 	battery=$(echo "$info" | grep -oP 'percentage: [0-9 ]*%') | ||||
| 	echo "$model: $battery" | ||||
| done | ||||
							
								
								
									
										9
									
								
								attic/checkupdates.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								attic/checkupdates.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| #UPDATES=$(checkupdates | sed ':a;N;$!ba;s/\n/ /g') | ||||
| CHECKUPDATES=$(checkupdates) | ||||
| UPDATES=$(echo "${CHECKUPDATES}" | sed 's/->/-\>/g' | sed ':a;N;$!ba;s/\n/<br>/g') | ||||
| NUM_UPDATES=$(echo "${CHECKUPDATES}" | wc -l) | ||||
| 
 | ||||
| #echo "{\"text\": \"${NUM_UPDATES}\", \"tooltip\":\"$UPDATES\"}" | ||||
| printf "{\"text\": \"%s\", \"tooltip\": \"%s\"}" $(checkupdates | wc -l) "$(checkupdates | tr '\n' '\r')" | ||||
| @ -3,8 +3,10 @@ | ||||
| appname=$1 | ||||
| sound="message" | ||||
| 
 | ||||
| if [ "$appname" = "Telegram-desktop" ]; then | ||||
| if [ $appname = "Telegram Desktop" ]; then | ||||
| 	sound="window-attention" | ||||
| fi | ||||
| 
 | ||||
| echo "$1" >> /tmp/test | ||||
| echo "$sound" >> /tmp/test | ||||
| mpv --no-terminal /usr/share/sounds/freedesktop/stereo/$sound.oga& | ||||
|  | ||||
							
								
								
									
										31
									
								
								fetchers/fetch_groupees.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								fetchers/fetch_groupees.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| #!/bin/python | ||||
| 
 | ||||
| import requests | ||||
| import sys | ||||
| import re | ||||
| 
 | ||||
| def get_urls(text): | ||||
|     text = text.replace('\n', ' ').replace('\r', '') | ||||
|     #r = re.compile("\"(https:([^<>]*))\">", re.I|re.M) | ||||
|     urls = [] | ||||
| 
 | ||||
|     matches = re.findall("\"(https:([^<>]*))\">", text) | ||||
|     if matches: | ||||
|         for m in matches: | ||||
|             urls.append(m[0]) | ||||
|     return urls | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     url = sys.argv[1] | ||||
|     jar = requests.cookies.RequestsCookieJar() | ||||
|     jar.set('_groupees_session', 'OWFWT1ZVTVZtdkFJU2NUUW5ZM2kwblNtTkFYVW0xdUhSWlVpdmROZE9ITWE0UDJIQlV5bmRpcXZLOTF5S1B1Z2lQZ08zUkJpT05FeVRaL0xQcDJJL1hKaVMvOWJPQUVvTTNzVjlaVERXQ2s5RE9WeEc4aWk1ZU9zMGVJd0tscGhLazZvSjVCQWZPMEdFWmVEdXZSYWNld3lTWDlyY1ZYdGdXOG54OXkrOUYyRjB4UXBpVUJJTXloZkN2REhYNTlwZ0s0NlVtbVNBclBRSXZEYVRmZXo1dz09LS0rOEkxVmUvR0ZCUEY1d3Y1RDVXSHd3PT0%3D--fc3a4f506f7c4a283a5d105ae9cb400b604a7fc8', domain='.groupees.com', path="/") | ||||
|     r = requests.get(url, cookies=jar) | ||||
|     urls = get_urls(r.text) | ||||
|     file_urls = [u for u in urls if "https://storage.groupees.com" in u] | ||||
| 
 | ||||
|     cookie = jar.get('_groupees_session') | ||||
|     print("header=\"Cookie:_groupees_session=%s;\"" % cookie) | ||||
|     for file_url in file_urls: | ||||
|         print("remote-header-name") | ||||
|         print("remote-name") | ||||
|         print("url=\"%s\"" % (file_url)) | ||||
							
								
								
									
										17
									
								
								gputemp.py
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								gputemp.py
									
									
									
									
									
								
							| @ -2,12 +2,19 @@ | ||||
| 
 | ||||
| import re | ||||
| import logging | ||||
| from logging.handlers import RotatingFileHandler | ||||
| import subprocess | ||||
| from subprocess import check_output | ||||
| import lib.helpers as helpers | ||||
| 
 | ||||
| FORMAT = "%(asctime)s %(levelname)s %(message)s" | ||||
| logging.basicConfig(format=FORMAT, filename=__file__+'.log', level=logging.DEBUG) | ||||
| log_formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s") | ||||
| 
 | ||||
| log_handler = RotatingFileHandler(__file__+'.log', maxBytes=1024*1024*10, mode='a', backupCount=0, encoding=None, delay=0) | ||||
| log_handler.setFormatter(log_formatter) | ||||
| log_handler.setLevel(logging.DEBUG) | ||||
| logger = logging.getLogger('root') | ||||
| logger.setLevel(logging.DEBUG) | ||||
| logger.addHandler(log_handler) | ||||
| 
 | ||||
| ATICONFIG_AVAILABLE = helpers.is_exe("/usr/bin/aticonfig") | ||||
| SENSORS_AVAILABLE = helpers.is_exe("/usr/bin/sensors") | ||||
| @ -16,7 +23,7 @@ def get_temperature(): | ||||
|     command = None | ||||
| 
 | ||||
|     if SENSORS_AVAILABLE: | ||||
|         commands = ["sensors amdgpu-pci-0800 | grep edge", | ||||
|         commands = ["sensors amdgpu-pci-0a00 | grep edge", | ||||
|                     "sensors radeon-pci-* | grep temp1", | ||||
|                     "sensors thinkpad-isa-0000 | grep ATI"] | ||||
| 
 | ||||
| @ -48,8 +55,8 @@ def get_temperature(): | ||||
|         m = re.search(r'- (.*) C', return_value.decode("utf-8")) | ||||
|         temp = m.group(1) | ||||
|     else: | ||||
|         logging.info('wat') | ||||
|     logging.info(temp) | ||||
|         logger.info('wat') | ||||
|     logger.info(temp) | ||||
|     return temp | ||||
| 
 | ||||
| print(get_temperature()) | ||||
|  | ||||
							
								
								
									
										47
									
								
								i3/xscreensaverstopper.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										47
									
								
								i3/xscreensaverstopper.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,47 @@ | ||||
| #!/bin/bash | ||||
| # xscreensaverstopper.sh | ||||
| 
 | ||||
| # This script is licensed under GNU GPL version 2.0 or above | ||||
| 
 | ||||
| # Uses elements from lightsOn.sh | ||||
| # Copyright (c) 2011 iye.cba at gmail com | ||||
| # url: https://github.com/iye/lightsOn | ||||
| # This script is licensed under GNU GPL version 2.0 or above | ||||
| 
 | ||||
| # Description: Restarts xscreensaver's idle countdown while | ||||
| # full screen applications are running. | ||||
| # Checks every 30 seconds to see if a full screen application | ||||
| # has focus, if so then the xscreensaver is told to restart | ||||
| # its idle countdown. | ||||
| 
 | ||||
| 
 | ||||
| # enumerate all the attached screens | ||||
| displays="" | ||||
| while read id | ||||
| do | ||||
|     displays="$displays $id" | ||||
| done< <(xvinfo | sed -n 's/^screen #\([0-9]\+\)$/\1/p') | ||||
| 
 | ||||
| checkFullscreen() | ||||
| { | ||||
| 
 | ||||
|     # loop through every display looking for a fullscreen window | ||||
|     for display in $displays | ||||
|     do | ||||
|         #get id of active window and clean output | ||||
|         activ_win_id=`DISPLAY=$DISPLAY.${display} xprop -root _NET_ACTIVE_WINDOW` | ||||
|         activ_win_id=${activ_win_id:40:9} | ||||
| 
 | ||||
|         # Check if Active Window (the foremost window) is in fullscreen state | ||||
|         isActivWinFullscreen=`DISPLAY=$DISPLAY.${display} xprop -id $activ_win_id | grep _NET_WM_STATE_FULLSCREEN` | ||||
|         if [[ "$isActivWinFullscreen" == *NET_WM_STATE_FULLSCREEN* ]];then | ||||
|         	xscreensaver-command -deactivate | ||||
| 	    fi | ||||
|     done | ||||
| } | ||||
| 
 | ||||
| while sleep $((30)); do | ||||
|     checkFullscreen | ||||
| done | ||||
| 
 | ||||
| exit 0 | ||||
							
								
								
									
										17
									
								
								import-gsettings
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								import-gsettings
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,17 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| # By default wayland only reads settings from gsettings and not from settings.ini | ||||
| 
 | ||||
| # usage: import-gsettings | ||||
| config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" | ||||
| if [ ! -f "$config" ]; then exit 1; fi | ||||
| 
 | ||||
| gnome_schema="org.gnome.desktop.interface" | ||||
| gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')" | ||||
| icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')" | ||||
| cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" | ||||
| font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" | ||||
| gsettings set "$gnome_schema" gtk-theme "$gtk_theme" | ||||
| gsettings set "$gnome_schema" icon-theme "$icon_theme" | ||||
| gsettings set "$gnome_schema" cursor-theme "$cursor_theme" | ||||
| gsettings set "$gnome_schema" font-name "$font_name" | ||||
| @ -12,7 +12,7 @@ case $op in | ||||
|                 ;; | ||||
|         lock) | ||||
|                 #loginctl lock-session | ||||
|                 swaylock -f -c 221122 | ||||
|                 swaylock -f -c 000000 | ||||
|                 ;; | ||||
|         logout) | ||||
|                 swaymsg exit | ||||
|  | ||||
							
								
								
									
										5
									
								
								run-xhost
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								run-xhost
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,5 @@ | ||||
| #!/bin/sh | ||||
| echo "$@" | ||||
| xhost +si:lanxu:root | ||||
| pkexec "$@" | ||||
| xhost -si:lanxu:root | ||||
							
								
								
									
										12
									
								
								startwayland
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								startwayland
									
									
									
									
									
								
							| @ -10,16 +10,22 @@ export XKB_DEFAULT_MODEL=pc105 | ||||
| # configure wayland backend | ||||
| export GDK_BACKEND=wayland | ||||
| export QT_QPA_PLATFORM=wayland # wayland-egl? | ||||
| export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 | ||||
| export QT_AUTO_SCREEN_SCALE_FACTOR=1 | ||||
| export CLUTTER_BACKEND=wayland | ||||
| export SDL_VIDEODRIVER=wayland | ||||
| export EWOL_BACKEND=wayland | ||||
| 
 | ||||
| # firefox | ||||
| export MOZ_ENABLE_WAYLAND=1 | ||||
| export MOZ_DBUS_REMOTE=1 | ||||
| 
 | ||||
| 
 | ||||
| # auth | ||||
| eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) | ||||
| export SSH_AUTH_SOCK | ||||
| #eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) | ||||
| #export SSH_AUTH_SOCK | ||||
| 
 | ||||
| # start! | ||||
| sway | ||||
| XDG_CURRENT_DESKTOP=sway XDG_SESSION_TYPE=wayland sway | ||||
| #XDG_CURRENT_DESKTOP=kde XDG_SESSION_TYPE=wayland dbus-run-session startplasma-wayland | ||||
| #XDG_CURRENT_DESKTOP=gnome XDG_SESSION_TYPE=wayland dbus-run-session gnome-shell --wayland | ||||
|  | ||||
							
								
								
									
										3
									
								
								steam
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								steam
									
									
									
									
									
								
							| @ -1,4 +1,5 @@ | ||||
| #!/bin/sh | ||||
| XDG_CURRENT_DESKTOP=XFCE xdg-dbus-proxy "$DBUS_SESSION_BUS_ADDRESS" "$XDG_RUNTIME_DIR/steam-bus-proxy" --filter --call="org.freedesktop.DBus.*=*" --call="org.freedesktop.IBus.*=*" --call="org.freedesktop.portal.*=*" --call="com.feralinteractive.GameMode.*=*" --call="com.canonical.*=*" --broadcast="*=*" --call="org.kde.*=*" --call="org.gtk.*=*" & | ||||
| #XDG_CURRENT_DESKTOP=XFCE xdg-dbus-proxy "$DBUS_SESSION_BUS_ADDRESS" "$XDG_RUNTIME_DIR/steam-bus-proxy" --filter --call="org.freedesktop.DBus.*=*" --call="org.freedesktop.IBus.*=*" --call="org.freedesktop.portal.*=*" --call="com.feralinteractive.GameMode.*=*" --call="com.canonical.*=*" --broadcast="*=*" --call="org.kde.*=*" --call="org.gtk.*=*" & | ||||
| xdg-dbus-proxy "$DBUS_SESSION_BUS_ADDRESS" "$XDG_RUNTIME_DIR/steam-bus-proxy" --filter --call="org.freedesktop.DBus.*=*" --call="org.freedesktop.IBus.*=*" --call="org.freedesktop.portal.*=*" --call="com.feralinteractive.GameMode.*=*" --call="com.canonical.*=*" --broadcast="*=*" --call="org.kde.*=*" --call="org.gtk.*=*" & | ||||
| DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/steam-bus-proxy" /usr/bin/steam | ||||
| kill %1 | ||||
|  | ||||
							
								
								
									
										6
									
								
								sway/fullscreen-inhibiter.service
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								sway/fullscreen-inhibiter.service
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| [Unit] | ||||
| Description=fullscreen inhibiter for sway | ||||
| 
 | ||||
| [Service] | ||||
| Type=oneshot | ||||
| ExecStart=/bin/sh /home/lanxu/Scripts/sway/fullscreen-inhibiter.sh | ||||
							
								
								
									
										10
									
								
								sway/fullscreen-inhibiter.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								sway/fullscreen-inhibiter.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,10 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| # Get all open windows from sway | ||||
| IN_FULLSCREEN=$(swaymsg -t get_tree | jq '[[recurse(.nodes[]) | del(.nodes)] | .[] | select((.window_properties.class) or (.app_id)) | {app_id: .app_id, class: .window_properties.class, fullscreen_mode: .fullscreen_mode}]' | jq 'any(.fullscreen_mode == 1)') | ||||
| 
 | ||||
| if [ $IN_FULLSCREEN = "true" ]; then | ||||
| 	dunstctl set-paused true | ||||
| else | ||||
| 	dunstctl set-paused false | ||||
| fi | ||||
							
								
								
									
										9
									
								
								sway/fullscreen-inhibiter.timer
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								sway/fullscreen-inhibiter.timer
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| [Unit] | ||||
| Description=Fullscreen inhibiter for Sway timer | ||||
| 
 | ||||
| [Timer] | ||||
| OnUnitActiveSec=10s | ||||
| OnBootSec=10s | ||||
| 
 | ||||
| [Install] | ||||
| WantedBy=timers.target | ||||
							
								
								
									
										3
									
								
								setup_table_sway.sh → sway/setup-tablet.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										3
									
								
								setup_table_sway.sh → sway/setup-tablet.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -5,7 +5,8 @@ | ||||
| 
 | ||||
| # Get ouputs | ||||
| # swaymsg -t get_outputs | ||||
| PAD_ID="9580:110:HID_256c:006e_Pad" | ||||
| #PAD_ID="9580:110:HID_256c:006e_Pad" | ||||
| PAD_ID="9580:110:HID_256c:006e" | ||||
| OUTPUT="DP-2" | ||||
| 
 | ||||
| echo "swaymsg 'input $PAD_ID map_to_output $OUTPUT'" | ||||
							
								
								
									
										9
									
								
								sway/take_screenshot.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								sway/take_screenshot.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| MODE=$1 | ||||
| FILENAME=$(xdg-user-dir PICTURES)/$(date +%F_%T_grim.png) | ||||
| 
 | ||||
| case $MODE in "region-copy") grim -g "$(slurp)" - | wl-copy;; | ||||
| 	"region") grim -g "$(slurp)" $FILENAME && notify-send -i "$FILENAME" "Screenshot saved";; | ||||
| 	*) grim $FILENAME && notify-send -i "$FILENAME" "Screenshot saved";; | ||||
| esac | ||||
							
								
								
									
										6
									
								
								sway_screensaver.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								sway_screensaver.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,6 @@ | ||||
| #!/usr/bin/env bash | ||||
| swayidle -w \ | ||||
| 	timeout 30 'swaylock -f -c 000000' \ | ||||
| 	timeout 60 'swaymsg "output * dpms off"' \ | ||||
| 		resume 'swaymsg "output * dpms on"' \ | ||||
| 	before-sleep 'swaylock -f -c 000000' | ||||
							
								
								
									
										9
									
								
								testing/run_zandronum.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								testing/run_zandronum.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| docker run -it \ | ||||
|   --rm \ | ||||
|   -p 10666:10666 \ | ||||
|   -v /usr/share/games/doom/:/wads:ro \ | ||||
|   --name=zandronum-server \ | ||||
|   frozenfoxx/zandronum-server:latest \ | ||||
|   -cooperative \ | ||||
|   -lan \ | ||||
|   -private | ||||
							
								
								
									
										3
									
								
								testing/sheet_process.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								testing/sheet_process.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| mogrify -format png *.tga | ||||
| rm *.tga | ||||
| mogrify -crop 256x400+0+0 +repage *.png | ||||
							
								
								
									
										100
									
								
								tools/24-bit-color.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								tools/24-bit-color.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,100 @@ | ||||
| #!/bin/bash | ||||
| # This file was originally taken from iterm2 https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh | ||||
| # | ||||
| #   This file echoes a bunch of 24-bit color codes | ||||
| #   to the terminal to demonstrate its functionality. | ||||
| #   The foreground escape sequence is ^[38;2;<r>;<g>;<b>m | ||||
| #   The background escape sequence is ^[48;2;<r>;<g>;<b>m | ||||
| #   <r> <g> <b> range from 0 to 255 inclusive. | ||||
| #   The escape sequence ^[0m returns output to default | ||||
| 
 | ||||
| setBackgroundColor() | ||||
| { | ||||
|     #printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3 | ||||
|     printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3 | ||||
| } | ||||
| 
 | ||||
| resetOutput() | ||||
| { | ||||
|     echo -en "\x1b[0m\n" | ||||
| } | ||||
| 
 | ||||
| # Gives a color $1/255 % along HSV | ||||
| # Who knows what happens when $1 is outside 0-255 | ||||
| # Echoes "$red $green $blue" where | ||||
| # $red $green and $blue are integers | ||||
| # ranging between 0 and 255 inclusive | ||||
| rainbowColor() | ||||
| {  | ||||
|     let h=$1/43 | ||||
|     let f=$1-43*$h | ||||
|     let t=$f*255/43 | ||||
|     let q=255-t | ||||
| 
 | ||||
|     if [ $h -eq 0 ] | ||||
|     then | ||||
|         echo "255 $t 0" | ||||
|     elif [ $h -eq 1 ] | ||||
|     then | ||||
|         echo "$q 255 0" | ||||
|     elif [ $h -eq 2 ] | ||||
|     then | ||||
|         echo "0 255 $t" | ||||
|     elif [ $h -eq 3 ] | ||||
|     then | ||||
|         echo "0 $q 255" | ||||
|     elif [ $h -eq 4 ] | ||||
|     then | ||||
|         echo "$t 0 255" | ||||
|     elif [ $h -eq 5 ] | ||||
|     then | ||||
|         echo "255 0 $q" | ||||
|     else | ||||
|         # execution should never reach here | ||||
|         echo "0 0 0" | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| for i in `seq 0 127`; do | ||||
|     setBackgroundColor $i 0 0 | ||||
|     echo -en " " | ||||
| done | ||||
| resetOutput | ||||
| for i in `seq 255 -1 128`; do | ||||
|     setBackgroundColor $i 0 0 | ||||
|     echo -en " " | ||||
| done | ||||
| resetOutput | ||||
| 
 | ||||
| for i in `seq 0 127`; do | ||||
|     setBackgroundColor 0 $i 0 | ||||
|     echo -n " " | ||||
| done | ||||
| resetOutput | ||||
| for i in `seq 255 -1 128`; do | ||||
|     setBackgroundColor 0 $i 0 | ||||
|     echo -n " " | ||||
| done | ||||
| resetOutput | ||||
| 
 | ||||
| for i in `seq 0 127`; do | ||||
|     setBackgroundColor 0 0 $i | ||||
|     echo -n " " | ||||
| done | ||||
| resetOutput | ||||
| for i in `seq 255 -1 128`; do | ||||
|     setBackgroundColor 0 0 $i | ||||
|     echo -n " " | ||||
| done | ||||
| resetOutput | ||||
| 
 | ||||
| for i in `seq 0 127`; do | ||||
|     setBackgroundColor `rainbowColor $i` | ||||
|     echo -n " " | ||||
| done | ||||
| resetOutput | ||||
| for i in `seq 255 -1 128`; do | ||||
|     setBackgroundColor `rainbowColor $i` | ||||
|     echo -n " " | ||||
| done | ||||
| resetOutput | ||||
							
								
								
									
										119
									
								
								tools/gif_anim_montage.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										119
									
								
								tools/gif_anim_montage.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,119 @@ | ||||
| #!/bin/sh | ||||
| # | ||||
| #  gif_anim_montage [options] animation.gif  [output_image] | ||||
| # | ||||
| # Convert a GIF animation into a strip showing each sub-frame of the | ||||
| # animation with a black border, positioned in the larger canvas context | ||||
| # of the animation.  Also include a label defining the size and position, | ||||
| # and disposal setting of each frame in the animation. | ||||
| # | ||||
| # OPTIONS: | ||||
| #    -u          Underlay a dimmed coaleased image (context for frame) | ||||
| #    -c          Add checkerboard background for transparent areas | ||||
| #    -g          Use granite for background | ||||
| #    -w          Use a white background | ||||
| #    -b          Use a black background | ||||
| #    -t image    Use this image (or color image) for background | ||||
| #    -r          Use a red border color rather than black | ||||
| #    #x#         tile the images   (default one single row) | ||||
| #    -n          Don't label the animation frames (not important) | ||||
| # | ||||
| #### | ||||
| # | ||||
| # WARNING: Input arguments are NOT tested for correctness. | ||||
| # This script represents a security risk if used ONLINE. | ||||
| # I accept no responsiblity for misuse. Use at own risk. | ||||
| # | ||||
| # Anthony Thyssen   Feburary 2006 | ||||
| # | ||||
| PROGNAME=`type $0 | awk '{print $3}'`  # search for executable on path | ||||
| PROGDIR=`dirname $PROGNAME`            # extract directory of program | ||||
| PROGNAME=`basename $PROGNAME`          # base name of program | ||||
| Usage() {                              # output the script comments as docs | ||||
|   echo >&2 "$PROGNAME:" "$@" | ||||
|   sed >&2 -n '/^###/q; /^#/!q; s/^#//; s/^ //; 3s/^/Usage: /; 2,$ p' \ | ||||
|           "$PROGDIR/$PROGNAME" | ||||
|   exit 10; | ||||
| } | ||||
| 
 | ||||
| border=black | ||||
| thickness=1x1 | ||||
| pointsize=10 | ||||
| tile='-tile x1' | ||||
| montage_opts="" | ||||
| method=1 | ||||
| background=none | ||||
| 
 | ||||
| # Figure out the montage label to use | ||||
| # Does IM understand %T as the frame time delay? | ||||
| label='%s: %D\n%wx%h%O' | ||||
| case `identify -format %T rose:` in | ||||
| 0) label="%D, %Tcs\n%wx%h%O" | ||||
| esac | ||||
| 
 | ||||
| 
 | ||||
| while [  $# -gt 0 ]; do | ||||
|   case "$1" in | ||||
|   --help|--doc*) Usage ;; | ||||
|   -u) method=2 ;;   # add disposal image context | ||||
|   -n) label='' ;;  # don't label the montage | ||||
|   -c) tile_image="pattern:checkerboard" ;; | ||||
|   -g) tile_image="granite:" ;; | ||||
|   -w) background="white" ;; | ||||
|   -b) background="black" ;; | ||||
|   -r) border=red  ;; | ||||
|   [0-9]*x*[0-9]|[0-9]*x|x*[0-9]) | ||||
|       X=`expr "$1" : '\([0-9]*\)x'` | ||||
|       Y=`expr "$1" : '[0-9]*x\([0-9]*\)$'` | ||||
|       tile="-tile ${X}x${Y}" | ||||
|       ;; | ||||
|   -) break ;;    # stdin filename | ||||
|   --) shift; break ;;    # end of user options | ||||
|   -*) Usage "Unknown option \"$1\"" ;; | ||||
|   *)  break ;;           # end of user options | ||||
|   esac | ||||
|   shift   # next option | ||||
| done | ||||
| 
 | ||||
| input="$1" | ||||
| [ $# -eq 0 ] && Usage "Missing Animation to Montage" | ||||
| [ $# -eq 1 ] && output='show:' | ||||
| [ $# -eq 2 ] && output="$2" | ||||
| [ $# -gt 2 ] && Usage "Too Many Arguments" | ||||
| 
 | ||||
| if [ "$tile_image" ]; then | ||||
|   montage_opts="$montage_opts -texture $tile_image" | ||||
| fi | ||||
| if [ "$background" ]; then | ||||
|   montage_opts="$montage_opts -background $background" | ||||
| fi | ||||
| 
 | ||||
| case "$method" in | ||||
|  1) # Montage only method | ||||
|     convert "$input" -set background none -alpha on -set label "$label" \ | ||||
|             -compose Copy -bordercolor $border -border $thickness \ | ||||
|             -set dispose Background -coalesce  miff:- |\ | ||||
|       montage - -frame 4 -geometry '+1+1' $tile \ | ||||
|               -bordercolor none -pointsize $pointsize \ | ||||
|               $montage_opts "$output" | ||||
|     ;; | ||||
|  2) # Montage with a disposed image underlay | ||||
|     # Still need some way to make the underlay partically transparent | ||||
|     convert "$input"  -set label "$label" -write mpr:a \ | ||||
|             -coalesce -bordercolor none -border $thickness \ | ||||
|             -channel A -evaluate divide 2 +channel  null: \ | ||||
|             \( mpr:a -bordercolor none -mattecolor $border -frame $thickness \ | ||||
|             \) -layers Composite \ | ||||
|             miff:- | \ | ||||
|       montage - -frame 4 -geometry '+1+1' $tile \ | ||||
|               -bordercolor none -pointsize $pointsize \ | ||||
|               $montage_opts  "$output" | ||||
|     ;; | ||||
|  3) # convert only method  -- no montage labels :-( | ||||
|     convert -dispose Background  "$input" \ | ||||
|             -compose Copy -bordercolor $border -border $thickness \ | ||||
|             -compose Over -coalesce  -bordercolor none   -frame 4x4+1+1 \ | ||||
|             -bordercolor none -border 2x2 +append -set delay 0 \ | ||||
|             $montage_opts  "$output" | ||||
| 
 | ||||
| esac | ||||
							
								
								
									
										81
									
								
								tools/updateorigin.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								tools/updateorigin.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,81 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| PATH32="drive_c/Program Files/Origin" | ||||
| PATH64="drive_c/Program Files (x86)/Origin" | ||||
| UPDATEPATH="" | ||||
| 
 | ||||
| update() { | ||||
|     local DIR="$1" | ||||
|     if which aria2c; then | ||||
|         command="aria2c -x8 -c" | ||||
|     else | ||||
|         command="wget" | ||||
|     fi | ||||
|     echo "Downloading latest Origin setup file:" | ||||
|      | ||||
|     if $command "https://download.dm.origin.com/origin/live/OriginSetup.exe"; then | ||||
|     echo "Extracting the installation file:" | ||||
|         unzip OriginSetup.exe 'update/*.zip' | ||||
|         unzip -o ./update/*.zip -d "$DIR" | ||||
|         echo "Cleaning up..." | ||||
|         rm -r ./update | ||||
|         rm OriginSetup.exe | ||||
|         echo "Done!" | ||||
|     fi | ||||
| } | ||||
| 
 | ||||
| if [[ ! -z "$WINEPREFIX" ]]; | ||||
| then | ||||
| 
 | ||||
|     # exit if no Origin folder can be found in the WINEPREFIX | ||||
|     if [[ ! -e "$WINEPREFIX/$PATH32" ]] && [[ ! -e "$WINEPREFIX/$PATH64" ]]; | ||||
|     then | ||||
|         echo "Origin not found in WINEPREFIX!" | ||||
|         echo "Please run this script again with the correct WINEPREFIX" | ||||
|         echo "or cd to your Origin directory and run the script there." | ||||
|         exit 1 | ||||
|     fi | ||||
| 
 | ||||
|     # check which installation of Origin is present. If both are (dunno why), then 64bit is being used | ||||
|     if [[ -e "$WINEPREFIX/$PATH32" ]]; | ||||
|     then | ||||
|         UPDATEPATH=$PATH32 | ||||
|         echo "Found a 32bit installation of Origin, going to use this:" | ||||
|     fi | ||||
|     if [[ -e "$WINEPREFIX/$PATH64" ]]; | ||||
|     then | ||||
|         UPDATEPATH=$PATH64 | ||||
|         echo "Found a 64bit installation of Origin, going to use this:" | ||||
|     fi | ||||
| 
 | ||||
|     # ouput the folder, so that the user has confirmation | ||||
|     echo "=> $WINEPREFIX/$UPDATEPATH" | ||||
| 
 | ||||
|     # now we do our magic! | ||||
|     update "$WINEPREFIX/$UPDATEPATH" | ||||
|     exit 0 | ||||
| 
 | ||||
| fi | ||||
| if [[ -z $WINEPREFIX ]] | ||||
| then | ||||
|     echo "WINEPREFIX not passed, checking working directory..." | ||||
|     if [[ -w "$PWD/Origin.exe" ]]; | ||||
|     then | ||||
|         update "$PWD" | ||||
|         exit 0 | ||||
|     fi | ||||
|     if [[ ! -w "$PWD/Origin.exe" ]]; | ||||
|     then | ||||
|         echo "Origin.exe not found in working directory!" | ||||
|         echo "Please enter your Origin installation path:" | ||||
|         read -e path | ||||
|         if [[ -w "$path/Origin.exe" ]]; | ||||
|         then | ||||
|             update "$path" | ||||
|         fi | ||||
|         if [[ ! -w "$path/Origin.exe" ]]; | ||||
|         then | ||||
|             echo "This path does not contain Origin.exe!" | ||||
|         fi | ||||
|     fi | ||||
| fi | ||||
							
								
								
									
										105
									
								
								tools/vimeo-audio-and-video.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										105
									
								
								tools/vimeo-audio-and-video.py
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,105 @@ | ||||
| #!/usr/bin/env python3 | ||||
| import argparse | ||||
| import base64 | ||||
| import os | ||||
| import re | ||||
| import requests | ||||
| import subprocess | ||||
| from tqdm import tqdm | ||||
| 
 | ||||
| parser = argparse.ArgumentParser() | ||||
| parser.add_argument('-i', '--url-list', help='List of URL/filename pairs, delimited by tabs') | ||||
| args = parser.parse_args() | ||||
| 
 | ||||
| for line in open(args.url_list): | ||||
|     output_file, master_json_url = line.rstrip().split('\t') | ||||
|     print('\n\n\nProcessing %s' % output_file) | ||||
| 
 | ||||
|     # Extract some stuff | ||||
|     base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1] | ||||
|     resp = requests.get(master_json_url) | ||||
|     content = resp.json() | ||||
| 
 | ||||
|     # Video download here | ||||
|     heights = [(i, d['height']) for (i, d) in enumerate(content['video'])] | ||||
|     idx = max(heights, key=lambda x: x[1])[0] | ||||
|     video = content['video'][idx] | ||||
|     video_base_url = base_url + content['base_url'] + video['base_url'] | ||||
|     print('Base url:', video_base_url) | ||||
| 
 | ||||
|     filenameVideo = 'video_%s.mp4' % video['id'] | ||||
|     print('Saving VIDEO to %s' % filenameVideo) | ||||
| 
 | ||||
|     video_file = open(filenameVideo, 'wb') | ||||
| 
 | ||||
|     init_segment = base64.b64decode(video['init_segment']) | ||||
|     video_file.write(init_segment) | ||||
| 
 | ||||
|     for segment in tqdm(video['segments']): | ||||
|         segment_url = video_base_url + segment['url'] | ||||
|         print(segment_url + '\n') | ||||
|         print(video_base_url+ '\n') | ||||
|         print(segment['url']+ '\n') | ||||
|         resp = requests.get(segment_url, stream=True) | ||||
|         if resp.status_code != 200: | ||||
|             print('not 200!') | ||||
|             print(resp) | ||||
|             print(segment_url) | ||||
|             break | ||||
|         for chunk in resp: | ||||
|             video_file.write(chunk) | ||||
| 
 | ||||
|     video_file.flush() | ||||
|     video_file.close() | ||||
| 
 | ||||
|     # Audio download here | ||||
|     bitrate = [(i, d['bitrate']) for (i, d) in enumerate(content['audio'])] | ||||
| 
 | ||||
|     print('Bitrate', bitrate) | ||||
| 
 | ||||
|     idx = max(bitrate, key=lambda x: x[1])[0] | ||||
|     audio = content['audio'][idx] | ||||
|     audio_base_url = base_url + content['base_url'] + audio['base_url'] | ||||
|     print('Base url:', audio_base_url) | ||||
| 
 | ||||
|     filenameAudio = 'audio_%s.mp4' % audio['id'] | ||||
|     print('Saving AUDIO to %s' % filenameAudio) | ||||
| 
 | ||||
|     audio_file = open(filenameAudio, 'wb') | ||||
| 
 | ||||
|     init_segment = base64.b64decode(audio['init_segment']) | ||||
|     audio_file.write(init_segment) | ||||
| 
 | ||||
|     for segment in tqdm(audio['segments']): | ||||
|         segment_url = audio_base_url + segment['url'] | ||||
|         segment_url = re.sub(r'/[a-zA-Z0-9_-]*/\.\./',r'/',segment_url.rstrip()) | ||||
|         resp = requests.get(segment_url, stream=True) | ||||
|         if resp.status_code != 200: | ||||
|             print('not 200!') | ||||
|             print(resp) | ||||
|             print(segment_url) | ||||
|             break | ||||
|         for chunk in resp: | ||||
|             audio_file.write(chunk) | ||||
| 
 | ||||
|     audio_file.flush() | ||||
|     audio_file.close() | ||||
| 
 | ||||
|     # Combine audio and video here | ||||
|     print('Combining video and audio...') | ||||
|     cmd = 'ffmpeg -y -i ' | ||||
|     cmd += filenameAudio | ||||
|     cmd += ' -i ' | ||||
|     cmd += filenameVideo | ||||
|     cmd += ' ' + output_file | ||||
|     subprocess.call(cmd, shell=True) | ||||
|     print('Mixing Done!') | ||||
| 
 | ||||
|     # Delete the remaining single audio and video files | ||||
| #    os.remove(filenameAudio) | ||||
| #    os.remove(filenameVideo) | ||||
| #    print("Temporary files removed!") | ||||
| 
 | ||||
|     # Log the conclusion of the operations | ||||
|     print("*** VIDEO DOWNLOADED SUCCESSFULLY ***") | ||||
|     print(video['base_url']) | ||||
							
								
								
									
										4
									
								
								wayland-setup/setup_wayland_apps.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								wayland-setup/setup_wayland_apps.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| # First, set flatpak overrides | ||||
| flatpak override --user --socket=wayland io.freetubeapp.FreeTube | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user