Skip to content

Instantly share code, notes, and snippets.

@bagder
bagder / tinycurl.sh
Last active July 12, 2024 12:51
build a tiny curl (on Linux)
#!/bin/sh
export CFLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto"
export LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections"
./configure \
--disable-cookies \
--disable-crypto-auth \
--disable-dict \
--disable-file \
--disable-ftp \
--disable-gopher \
@marcomagdy
marcomagdy / Google MFA
Last active May 30, 2023 17:43
Google MFA in C#
class Program
{
static void Main(string[] args) {
var secretByets = Base32Encoding.ToBytes("supersecretpassword");
var input = GetEpoch() / 30;
var hmac = new HMACSHA1(secretByets);
var output = hmac.ComputeHash(toBytes(input));
Console.WriteLine("{0:d6}", calculate(output));