Skip to content

Instantly share code, notes, and snippets.

@landgenoot
landgenoot / gist:c472d283ae46ce8f7e104b077a5e3af0
Created February 22, 2024 11:55
Convert vobsub to srt subtitles inside mkv
tracks=$(mkvinfo "$1" | gawk '
match($0, /mkvextract: ([0-9]+)/, m) {TN=m[1]} \
match($0, /Language: ([a-z]+)/, m) {CI=m[1]} \
/Track type: subtitles/ {SUB=1} \
/^\| \+ Track$/ {if(SUB) print TN, CI, "\n"; SUB=0;} \
END {if(SUB) print TN, CI; SUB=0}')
IFS=$'\n'
mergecommand=\"$1\"
for track in $tracks
do
@landgenoot
landgenoot / cloudflare-email-worker-recipient-flag-parser.js
Last active June 28, 2023 19:33
Cloudflare Email Worker that parses flags in the local-part of the email address (e.g. somerandomtext-a@example.com), even if the receipient is in the BCC. Corresponding blog post: https://daanmiddendorp.com/tech/2023/06/28/parsing-bcc-recipient-with-cloudflare-email-workers
/**
* Cloudflare Email Worker that parses flags (e.g. -a) and forwards accordingly.
*
* Example:
* somerandomtext-a@example.com would forward to Alice.
* somerandomtext-b@example.com would forward to Bob.
*/
async function email(message, env, ctx) {
let messageSource = await fetchMessageSource(message.raw);
let blacklist = await fetchBlacklist("https://example.com/blacklist.txt");
#!/bin/python
# Calculate address from public key according to http://www.multichain.com/developers/address-key-format/
import asn1
import base58
import base64
import binascii
import hashlib
import os
import sys
#!/bin/python
# Calculate address from public key according to http://www.multichain.com/developers/address-key-format/
import asn1
import base58
import base64
import binascii
import hashlib
import os
import sys
#!/bin/python
from pypassport import epassport, reader
from pypassport import fingerPrint
from pypassport.doc9303 import converter
import os
import base64
from ecdsa import VerifyingKey, BRAINPOOLP320r1
from hashlib import sha256
MRZ = ""
// g++ -Wall ecdsa-test.cpp -o ecdsa-test -lcryptopp && ./ecdsa-test
#include <iostream>
using std::cout;
using std::cerr;
using std::endl;
#include <string>
using std::string;