Skip to content

Instantly share code, notes, and snippets.

@nottux
nottux / huion_rotate.sh
Last active March 14, 2021 16:47
Rotate drawing tablet 180 degrees on linux while using multiple or single monitor(s)
bash -c 'name="HUION Huion Tablet Pen (0)";a=($(xinput list-props "$name"| grep -Po "Coordinate\sTransformation\sMatrix(.*?):\s\K.*"|tr -d ","));a[2]=$(echo ${a[0]}+${a[2]}|bc);a[5]=$(echo ${a[4]}+${a[5]}|bc);a[0]=$(echo ${a[0]}*-1|bc);a[4]=$(echo ${a[4]}*-1|bc);xinput set-prop "$name" "Coordinate Transformation Matrix" ${a[*]}'
@nottux
nottux / vpn.sh
Last active January 18, 2021 12:41
namespaced vpn but easy
#!/bin/bash
pipe=/tmp/outpipe_vpn
case "$1" in
firefox|web|fox) app="firefox --private-window";;
haku|neko|nero|hakuneko|hakunero) app="/usr/lib/hakuneko-desktop/hakuneko";;
shell|sh) app="echo openning shell";;
*) app="firefox --private-window";;
esac
@nottux
nottux / af.sh
Last active January 16, 2021 19:12
a script to auto connect my android phone
#!/bin/bash
a=android-aa8b17a6b252b32
b=/tmp/casper_ip.txt
c="192.168.43.1"
d=$(route -n | awk '{if($4=="UG")print $2}')
e=$(ip -o -f inet addr show | grep -Po "/[[:digit:]]{1,2}(?=.*scope\sglobal)")
if [ "$1" = "$z" ]
then :
else if [ -f "$b" ]
sudo su -c '((while avahi-daemon -c;do avahi-daemon -k;done)&(while pgrep akonadi;do pkill -ce akonadi;done)&(while pgrep kio;do pkill -ce kio;done);echo done individuals)&for i in whoopsie cups packagekit apache2 openvpn apport gdm3 php7.4-fpm snapd winbind nmbd smbd teamviewerd ;do (while systemctl is-active $i;do systemctl stop $i;done)&done;wait $!;echo done all'
sudo su -c 'pkill -ce cdemu'
@nottux
nottux / this_is_not_a_scritpt.sh
Created May 30, 2020 23:37
This took ~two days but worth it
#To list files& folders that going to be removed:
eval "echo !($((a=/home/utku;find /home/utku3 /mnt/old_drive/utku2 -type l -ls|sed 's/-> /\t/g;s/\\303\\266/ö/g;s/\\303\\274/ü/g'|cut -f 2|grep $a/;echo -e $a/took\\n$a/Belgeler\\n$a/İndirilenler)|sed s/$(echo $(pwd)|sed 's/\//\\\//g')//g|sed 's/\//\t/g'|cut -f 2|tr \\n '|'))"
#To remove said folders:
eval "sudo rm -rfv !($((a=/home/utku;find /home/utku3 /mnt/old_drive/utku2 -type l -ls|sed 's/-> /\t/g;s/\\303\\266/ö/g;s/\\303\\274/ü/g'|cut -f 2|grep $a/;echo -e $a/took\\n$a/Belgeler\\n$a/İndirilenler)|sed s/$(echo $(pwd)|sed 's/\//\\\//g')//g|sed 's/\//\t/g'|cut -f 2|tr \\n '|'))"
#Lists again but changed for utku2
eval "echo !($((a=/home/utku2;find /home/utku3 /mnt/old_drive/utku -type l -ls|sed 's/-> /\t/g;s/\\303\\266/ö/g;s/\\303\\274/ü/g'|cut -f 2|grep $a/;echo -e $a/took\\n$a/Belgeler\\n$a/İndirilenler)|sed s/$(echo $(pwd)|sed 's/\//\\\//g')//g|sed 's/\//\t/g'|cut -f 2|tr \\n '|'))"
#You get the idea
#I have got bit more into sed with this and learnt a l
a=$(ls -lq *jpg *gif *png|wc -l);while [ $a -lt 392 ];do for i in {0..392};do (b=$(curl https://www.vgcats.com/comics/?strip_id=$i|grep -roEe 'src=\"images/.*jpg' -Ee 'src=\"images/.*gif' -Ee 'src=\"images/.*png' -|cut -c 13-);if ls $b;then echo existing;else wget --retry-on-http-error --no-clobber https://www.vgcats.com/comics/images/$b;fi)&done;find . -type f -not -name '*jpg' -not -name '*gif' -not -name '*png' -print0|xargs -0 rm --;a=$(ls -lq *jpg *gif *png|wc -l);done
@nottux
nottux / what happened to mima touhou.txt
Created March 7, 2020 16:47
what happened to mima touhou.txt
based on https://twitter.com/KaliningradG/status/1235698723310710785?s=20
mima decided to be an FOSS advocate and since been found crying in a corner because zun has copyight on her and zun likes beer money woouhou 🍺
She found playing taisei sometimes but she is really broken you know :(
She wants to forgetten and recreated with no colleration to zun zun wouhou project.
@nottux
nottux / powsav.sh
Last active March 22, 2021 16:01
That's how you save power
#!/bin/bash
if ls /tmp/fr_powsav.sh &>/dev/null
#credits to "Ric Klaren" @askubuntu.com https://askubuntu.com/a/1026527/928621
then HIDDEVICES=$(ls /sys/bus/usb/drivers/usbhid | grep -oE '^[0-9]+-[0-9\.]+' | sort -u)
for i in $HIDDEVICES; do
echo -n "Enabling " | cat - /sys/bus/usb/devices/$i/product
echo 'on' | sudo tee /sys/bus/usb/devices/$i/power/control >/dev/null
done
@nottux
nottux / gamemode.ini
Last active January 10, 2021 16:27
My gamemode.ini file
[general]
; The reaper thread will check every 5 seconds for exited clients and for config file changes
reaper_freq=5
; The desired governor is used when entering GameMode instead of "performance"
desiredgov=performance
; The default governer is used when leaving GameMode instead of restoring the original value
defaultgov=powersave
; GameMode can change the scheduler policy to SCHED_ISO on kernels which support it (currently
@nottux
nottux / A515-41G-T48Q.txt
Last active May 30, 2020 23:42
https://www.linux-on-laptops.com , ACER ASPIRE 5 A515-41G-T48Q
Acer Aspire 5 A515-41G-T48Q , BIOS : 1.09, Pop!_OS 19.10/19.04, Linux kernels newer than 5.3.0-050300rc1-generic (see https://bugzilla.kernel.org/show_bug.cgi?id=201077)
https://www.linux-on-laptops.com
##############PROBLEMATIC STUFF##################
Sleep sometimes work, sometimes it hangs while waking up. This happens on some kernel versions
Some kernel versions also broke things or render laptop useless, however as of 5.6 everything seems fine again
#################################################
##############WORKING STUFF######################
AMD RADEON RX 540 discrete gpu: Work as intended (Only powers on when a program is launched with DRI_PRIME=1, Power dpm state can be forced), may need thermal paste change