💾 Archived View for snowcode.ovh › scripts.gmi captured on 2022-01-08 at 13:44:17. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2022-03-01)

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

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>

Email

#!/bin/bash
SPAMLIST=$(cat ~/spam.txt)
MSGLIST=$(himalaya -o json list -s 3000)
echo "$MSGLIST" | jq '.[]' | jq "map(select(.sender | contains($SPAMLIST)))" | jq '.[].id' | tr '\n' ','
himalaya delete $(echo "$MSGLIST" | jq '.[]' | jq "map(select(.sender | contains($SPAMLIST)))" | jq '.[].id' | tr '\n' ',')
himalaya -o json list -s 3000 | jq .[][].sender | sort | uniq -c | sort -n

Gemini

#!/bin/bash
rsync -rv ./* debian@51.178.55.122:/home/debian/gemini/
alias qw='cd ~/gemini1/ && nano flight.gmi && ./reload.sh'

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