💾 Archived View for snowcode.ovh › scripts.gmi captured on 2022-07-16 at 13:33:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-04-28)

-=-=-=-=-=-=-

My scripts

Here are some of my scripts I use everyday.

GPG

gpg --expert --full-gen-key
# Select ECC&ECC then Curve 25519
gpg -ea
# Answer the questions, then type your message then press CTRL+D to finish

gpg -da
# Paste the encrypted message
# On receipient device: generate temp key pair, export temp public key
gpg --gen-key
gpg --export <your name> >> /tmp/public.gpg
curl -F "file=@/tmp/public.asc" https://x0.at

# On sender device: download/import temp public, export public key, encrypt private key and send them
wget <url to public>
gpg --import <file public>
gpg --export <your name> >> /tmp/public.gpg
gpg --export-secret-keys <your name> >> /tmp/private.gpg
gpg --encrypt /tmp/private.asc >> /tmp/private-encrypt.gpg
curl -F "file=@/tmp/private-encrypt.gpg" https://x0.at
curl -F "file=@/tmp/public.gpg" https://x0.at

# On receipient: download keys, decrypt private key, import them
wget <url to encrypted private key>
wget <url to public key>
gpg --import <public file>
gpg --decrypt <private encrypted file> >> /tmp/private.gpg
gpg --import /tmp/private.gpg

# On both for cleaning: remove the downloaded keys and 
rm *.gpg /tmp/*.gpg # WARNING, don't be dumb
gpg --delete-secret-and-public-key <temp keys>
# Sender device
gpg -cao /tmp/secret.asc <secret file>
curl -F "file=@/tmp/secret.asc" https://x0.at

# Recipient device
wget <url>
gpg -do <secret file's name> <file>

Email

# spam.txt format: first\|second\|third
himalaya del $(NO_COLOR=1 himalaya list -s 3000 -w 10000 | grep "$(cat ~/spam.txt)" | awk '{ print $1 }' | tr '\n' ',')
himalaya -o json list -s 3000 | jq .[][].sender | sort | uniq -c | sort -n
himalaya -m [Gmail]/All\ Mail read "$(NO_COLOR=1 himalaya -m [Gmail]/All\ Mail | sed '3q;d' | awk '{ print $1 }')"

Gemini

$ sshfs debian@snowcode.ovh:/home/debian/gemini/ ~/gemini-remote/

FFMPEG

$ ffmpeg -f x11grab -i :0.0 -preset ultrafast screenrecording.mkv
$ ffmpeg -f x11grab -i :0.0 -f pulse -ac 2 -i default -preset ultrafast screenrecording.mkv
$ ffmpeg -f pulse -ac 2 -i default audiorecording.mp3
$ ffmpeg -i input.mkv -vcodec libx265 -crf 28 output.mp4
$ ffmpeg -i input.mp4 -pix_fmt yuv420p output.mp4
$ ls *.mp4 | xargs -I {} echo "file '{}'" >> list1.txt
$ ffmpeg -f concat -i list.txt -c copy output.mp4

Termux

# on termux
sshd
ifconfig wlan0 # get ip

# on laptop
ssh <ip> -p 8022
# on termux
sshd

# on laptop
adb forward tcp:8022 tcp:8022
ssh localhost -p 8022
# on laptop
mkdir termux/
sshfs <ip>:/data/data/com.termux/files/home -p 8022 termux/
# In ~/bin/termux-file-editor in termux
#!/bin/bash
[ "$(basename $1)" == "send.mp4" ] \
    && ffmpeg -i $1 -c:v libx265 -c:a aac -crf 28 temp.mp4 \
    && ffmpeg -i temp.mp4 -pix_fmt yuv420p final.mp4 \
    && termux-open --send final.mp4
# translation: checks if the file is named "send.mp4", re-encode it, add pix_fmt to enable preview on Discord and Whatsapp, send the file (open the "Share" menu of the phone)
# In ~/bin/termux-file-editor
# Requires termux-api package and Termux:API app
#!/bin/bash
echo "$1" | grep "x0." && curl -F "file=@$1" https://x0.at | termux-clipboard-set
# translation: if filename contains "x0." then upload the file to x0 and copy the url in clipboard

Kali Linux

Download Kali Live Boot

$ fdisk -l
$ dd if=<path to ISO file> of=/dev/<device name>
# Connect drive to computer and enter boot menu (hold F2 + boot then F8)
$ fdisk -l
$ mount /dev/<name of the disk> /mnt
$ chntpw -i /mnt/Windows/System32/config/SAM
# Select your user then press 1 then "y"
$ umount /mnt
$ poweroff

Imagemagick

$ convert -background none -size 1024x1024 infile.svg outfile.png

Nitrokey

$ cd /etc/udev/rules.d
$ sudo wget https://raw.githubusercontent.com/Nitrokey/libnitrokey/master/data/41-nitrokey.rules
$ sudo systemctl restart udev
$ sudo apt install libpam-u2f
$ mkdir ~/.config/Nitrokey
$ pamu2fcfg > ~/.config/Nitrokey/u2f_keys
$ sudo cp -r ~/.config/Nitrokey /etc
$ pamu2fcfg -n > ~/.config/Nitrokey/backup
$ sudo echo "auth    sufficient pam_u2f.so authfile=/etc/Nitrokey/u2f_keys cue prompt nouserok" >> /etc/pam.d/common-auth
$ sudo passwd -d <username> 
$ sudo nano /etc/pam.d/common-auth # Replace sufficient by required
$ ssh-keygen -t ecdsa-sk -O resident
$ ssh-copy-id <username>@<server>

Bluetooth

$ bluetoothctl power on
$ bluetoothctl scan on
$ bluetoothctl devices
$ bluetoothctl trust <device ID>
$ bluetoothctl pair <device ID>
$ bluetoothctl connect <device ID>
$ pactl set-default-sink <default sink bluez_sink.F8_DF_15_F7_74_AE.a2dp_sink>

Discord and Powercord related stuff

cd /opt
# Download Discord Canary in your browser https://discord.com/api/download/canary?platform=linux&format=tar.gz
sudo mv ~/Downloads/discord-canary*.tar.gz /opt
sudo tar xvf discord-canary*.tar.gz
sudo ln -s /opt/DiscordCanary/DiscordCanary /usr/bin/discord
sudo rm discord-canary.tar.gz
git clone https://github.com/powercord-org/powercord
cd powercord
npm i
sudo npm run plug
cd powercord/src/Powercord/plugins
git clone https://github.com/beerpiss/hide-blocked-messages
git clone https://github.com/redstonekasi/theme-toggler
git clone https://github.com/mr-miner1/better-settings