Skip to content

Instantly share code, notes, and snippets.

View neuthral's full-sized avatar
🦌
bubbling

neuthral neuthral

🦌
bubbling
View GitHub Profile
@neuthral
neuthral / powertop-custom.md
Last active May 16, 2024 08:35
powertop custom startup service

on ubuntu 22.04 i need to have powertop run on startup as a service as powertop --auto-tune to set all devices on "good" power saving status but this also disables mouse and keyboard so its very annoying to have to wake up the device before using it again after 5 seconds

powertune.sh script sets all devices on powersave except usb

edit powertop.service to start yourt script in the correct location in ExecStart=(path to script) copy the service to: /etc/systemd/system/powertop.service

@neuthral
neuthral / json
Created February 23, 2024 15:26
phantomsandmonsters.com ublock filter to actually view the blog decently
! 2024-02-23 https://www.phantomsandmonsters.com
www.phantomsandmonsters.com##div.separator > span > .separator
www.phantomsandmonsters.com##div.separator > span > div > div
||www.phantomsandmonsters.com/ezoimgfmt/blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKOOyxs-r7qPL9LPnK1BGUAtiwqBNFp0ZzT1-Kd76B8HM9KS2d6RBuWrXSK8lWAqtXZaJQeKsiLHBPftawQa8n-Wckei2SPKXkXwQrIH3OmQCMBjGbE1DKDZGIV1jrkRleQ_08xgjxWrVmULpB-KsQw7Xa1XBZVq2_TCKD9z6LUngglcAK/w320-h91/buymeacoffee.JPG?ezimgfmt=rs:336x107/rscb1/ng:webp/ngcb1$image
www.phantomsandmonsters.com##div .post-body > div > div.separator
www.phantomsandmonsters.com##div .post-body > div > div > div.separator
www.phantomsandmonsters.com##div .post-body > div > center > div.separator
www.phantomsandmonsters.com##div > center > center > center > center
www.phantomsandmonsters.com##div.separator > p
www.phantomsandmonsters.com##div .post-body > div > span > span > div
@neuthral
neuthral / img-encode.js
Created March 16, 2023 11:06
js encode image data to ascii and back to Uint8Array
const fs = require("fs");
let imageFile = fs.readFileSync('image.jpg', null).buffer
let imgArray = new Uint8Array(imageFile)
let text = ''
imgArray.forEach(n => {
text += String.fromCharCode(n + 256)
})
console.table(imgArray, text, '\n')
@neuthral
neuthral / img-encode.js
Created March 16, 2023 11:05
js encode image data to ascii and back to Uint8Array
const fs = require("fs");
let imageFile = fs.readFileSync('image.jpg', null).buffer
let imgArray = new Uint8Array(imageFile)
let text = ''
imgArray.forEach(n => {
text += String.fromCharCode(n + 256)
})
console.table(imgArray, text, '\n')
@neuthral
neuthral / transmission_add_trackers.sh
Created November 26, 2022 11:48
add list of trackers to transmission downloads
#!/bin/bash
# Get transmission credentials, if set
if [[ -n "$TRANSMISSION_USER" && -n "$TRANSMISSION_PASS" ]]; then
auth="${TRANSMISSION_USER:-user}:${TRANSMISSION_PASS:-password}"
else
auth=
fi
#https://gist.github.com/neuthral/3690548c19a7740a9620794bc4537568/raw/62791f6884897420c96c86c121529f1ef1671b84/alive_trackers_26_11_2022.txt
#https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt
http://107.189.10.20.sslip.io:7777/announce
http://1337.abcvg.info:80/announce
http://207.241.226.111:6969/announce
http://207.241.231.226:6969/announce
http://bt.okmp3.ru:2710/announce
@neuthral
neuthral / loop.sh
Last active November 25, 2022 22:17
Loop through list of trackers and test if they are alive using nc
#!/bin/bash
##
# Loop through list of trackers and test if they are alive using nc
# nc -v -z -w 3 -u "$host" "$port"
##
usage () {
printf '\n%s\n' "Loop through list of trackers and test if they are alive using nc"
printf '\n%s\n\n' "Usage: $(basename "$0") [list-of-trackers.file]"
@neuthral
neuthral / reduce.sh
Created November 23, 2022 03:00
count together numbers in a string until only one number from 1 - 9 remains [??vortex math??]
#!/bin/bash
STRING=$1
NUM=0
until [[ $STRING -lt 10 ]] do;
foreach n in $(echo $STRING | fold -w1); do
echo "$NUM + $n";
((NUM=NUM+n));
echo " = $NUM";
done;
@neuthral
neuthral / clean-sub.sh
Created October 9, 2022 21:52
clean youtube subtitle files and clean-up them for reading
echo $1
echo "Removing --> time stuff"
sed -i '/-->/d' $1
echo "Removing empty lines"
grep "\S" $1 > $1.txt
echo "wrap long lines to 96 characters"
fold -sw 96 $1.txt > $1.txt.fix
@neuthral
neuthral / youtube-get-sub.sh
Created October 8, 2022 09:02
youtube get video subtitles and cleant up the file for readability
youtube-get-subs() {
echo "getting filenames..."
filename=$(youtube-dl --simulate --get-title $1)-$(youtube-dl --simulate --get-id $1)
echo "Downloading video data"
youtube-dl --continue --write-auto-sub --sub-format vtt --sub-lang en --write-thumbnail --write-description --skip-download $1
echo $filename
echo "Removing --> time stuff"
sed -i '/-->/d' $filename.en.vtt
echo "Removing empty lines"
grep "\S" $filename.en.vtt > $filename.txt