Skip to content

Instantly share code, notes, and snippets.

View antelle's full-sized avatar

Dimitri Witkowski antelle

View GitHub Profile
@antelle
antelle / FiddlerScript.cs
Last active July 5, 2023 22:32
Change response in Fiddler
static function OnBeforeRequest(oSession: Session) {
if (oSession.RequestMethod == 'GET' && oSession.PathAndQuery.IndexOf('part_of_your_url') > 0) {
oSession.utilCreateResponseAndBypassServer();
oSession.oResponse.headers.HTTPResponseCode = 401;
oSession.oResponse.headers.HTTPResponseStatus = '401 Not Authorized';
oSession.oResponse.headers['Access-Control-Allow-Origin'] = '*';
oSession.utilSetResponseBody('response_body');
}
}
@antelle
antelle / openssl.sh
Created September 6, 2019 16:43
OpenSSL file encrypt/decrypt
# encrypt file.txt to file.enc using 256-bit AES in CBC mode
openssl enc -aes-256-cbc -salt -in file.txt -out file.enc
# the same, only the output is base64 encoded for, e.g., e-mail
openssl enc -aes-256-cbc -a -salt -in file.txt -out file.enc
# decrypt binary file.enc
openssl enc -d -aes-256-cbc -in file.enc -out file.txt
# decrypt base64-encoded version
@antelle
antelle / ram_disk.sh
Created September 6, 2019 16:41
Create a RAM disk on macOS
# 42 = desired disk size in megabytes
diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://$((42*2048))`
@antelle
antelle / blink.css
Last active September 12, 2022 02:12
Blink
@antelle
antelle / yubikey-hmac-secret.sh
Created March 29, 2021 21:10
PoC of using FIDO2 hmac-secret with a YubiKey
# https://github.com/trezor/trezor-firmware/blob/master/tests/fido_tests/libfido2/hmac-secret.sh
# DEVICE=$(fido2-token -L | cut -d : -f 1)
DEVICE=$(fido2-token -L | cut -d : -f 1-2)
if [ -z "$DEVICE" ] ; then
echo "No FIDO2 token found"
exit 1
fi
@antelle
antelle / codesign-macos.sh
Created March 27, 2021 15:06
Code signing on macOS
# show all
codesign -dv -vvvvvv my.app
# print entitlements
codesign --display --entitlements :- my.app
# get certificates
codesign --display --extract-certificates my.app
@antelle
antelle / shebang.sh
Last active March 27, 2021 15:05
bash shebang
#!/bin/bash
set -euxo pipefail
@antelle
antelle / x11-print-layout.cpp
Created March 20, 2021 11:54
x11-print-layout.cpp
// g++ x11-print-layout.cpp -lX11 -o x11-print-layout
// dumps keybaord layout on x11
#include <X11/XKBlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <iostream>
Display *display;
const started = process.hrtime();
// something
const elapsed = process.hrtime(started);
const elapsedMs = Math.round(elapsed[0] * 1e3 + elapsed[1] / 1e6);
console.log(`Elapsed ${elapsedMs} ms`);
@antelle
antelle / invisibles.txt
Last active April 6, 2020 09:21
Invisibles
U+2060 foo⁠bar WORD JOINER
U+2061 foo⁡bar FUNCTION APPLICATION
U+2062 foo⁢bar INVISIBLE TIMES
U+2063 foo⁣bar INVISIBLE SEPARATOR
U+180E foo᠎bar MONGOLIAN VOWEL SEPARATOR
U+200B foo​bar ZERO WIDTH SPACE
U+200C foo€€‌bar ZERO WIDTH NON-JOINER
U+200D foo‍bar ZERO WIDTH JOINER
U+FEFF foobar ZERO WIDTH NO-BREAK SPACE