Skip to content

Instantly share code, notes, and snippets.

@ignatk
ignatk / derived.py
Last active February 1, 2025 21:38
TPM derived keys
#!/usr/bin/python3
# requires gokey, keyutils, openssl, tpm2-tools
# configure with
# echo 'create * tpm2:derived:* * |<path to this script> %t %d %c %u %g' > /etc/request-key.d/derived.conf
import hashlib
import os
import subprocess
import sys

Generate input

sox -r 44100 -n -b 16 -c 2 input.wav synth 1800 vol -1dB

Record output

parec -d <sink>.monitor | sox -t raw -b 16 -e signed -c 2 -r 44100 - output.wav
@katopz
katopz / ts-dl.sh
Created August 16, 2017 15:49
Download .ts video file by ffmpeg via .m3u8
# Install ffmpeg
brew install ffmpeg
# Download
ffmpeg -i https://foo.com/bar.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4
@tam7t
tam7t / certdump.go
Created September 1, 2016 19:02
certdump consul-template plugin for writing vault-generated certificates to separate files
package main
import (
"io/ioutil"
"log"
"os"
"os/user"
"strconv"
)
@dreikanter
dreikanter / encrypt_openssl.md
Last active August 9, 2025 14:38 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

#!/usr/bin/python
#
# Convert a Row-Based-Replication binary log to Statement-Based-Replication format, cheating a little.
#
# Additional added some code to transfer INSERT clauses to proper column names.
#
# Usage: mysqlbinlog -v --base64-output=DECODE-ROWS $log | python binlog-rbr-to-sbr.py -hHOST -uUSERNAME -pPASSWORD - | grep -B 1 '^INSERT '
# Based on: https://gist.github.com/shlomi-noach/cc243fd690403e7617e3
#