Skip to content

Instantly share code, notes, and snippets.

View Yawning's full-sized avatar
💭
🐈‍⬛

Yawning Angel Yawning

💭
🐈‍⬛
View GitHub Profile
@Yawning
Yawning / unfuck-libedit.sh
Created February 22, 2024 09:08
Make odin Linux release builds usable on normal systems.
#!/bin/sh
#
# The Odin binary package is built on Ubuntu, which inherits Debian's
# libedit stupdity. This makes the binary builds unusable, but it
# is easy to fix with patchelf to change the dependency to what normal
# systems ship.
#
# See: https://salsa.debian.org/debian/libedit/-/blob/master/debian/patches/update-soname.diff
#
@Yawning
Yawning / orhttp_example.go
Created April 29, 2015 14:41
How to dispatch HTTP requests via Tor in Go.
// To the extent possible under law, the Yawning Angel has waived all copyright
// and related or neighboring rights to orhttp_example, using the creative
// commons "cc0" public domain dedication. See LICENSE or
// <http://creativecommons.org/publicdomain/zero/1.0/> for full details.
package main
import (
// Things needed by the actual interface.
"golang.org/x/net/proxy"
@Yawning
Yawning / nsareduce.go
Created October 27, 2023 03:27
k = (c mod (n − 1)) + 1, without using `math/big`
// Copyright (c) 2023 Yawning Angel. All Rights Reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
@Yawning
Yawning / linux_get_external_addr.c
Last active October 5, 2022 15:16
Querying the address used to reach the outside world, the correct way. (Linux).
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@Yawning
Yawning / elligator2.h
Last active March 20, 2020 07:38
(DEPRECATED) A mostly drop in elligator2 for ed25519-donna.
There used to be something that resembled an Elligator2 implementation here ported from agl's
Go code. The implementation is unmaintained and has severe issues (as pointed out in a comment),
and should not be used for anything.
@Yawning
Yawning / gist:9501996
Created March 12, 2014 06:39
Python CTR_DRBG (CTR-AES-128)
""" NIST SP 800-90A style CTR_DRBG, using CTR-AES-128. """
import obfsproxy.common.aes as aes
import binascii
import os
import random
class CtrDrbg(random.Random):
"""
From 117b56d5315287bb15948f448229431101d48380 Mon Sep 17 00:00:00 2001
From: Yawning Angel <yawning@schwanenlied.me>
Date: Mon, 19 Nov 2018 22:52:41 +0000
Subject: [PATCH] BSD: OSX portability fixes
* RFC 3542 constants require `__APPLE_USE_RFC_3542` to be defined.
* TCP MD5 signatures are not supported by the kernel at all.
---
sysdep/bsd/sysio.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
@Yawning
Yawning / gist:e2b52d373b21278e34dd00c7a04ac900
Created July 30, 2018 09:56
Updated `01_acpi` script.
#! /bin/sh -e
# Uncomment to load custom ACPI table
GRUB_CUSTOM_ACPI="/boot/dsdt.aml"
# DON'T MODIFY ANYTHING BELOW THIS LINE!
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
@Yawning
Yawning / gist:2829f9adf889f1334005
Created January 2, 2015 10:41
gettimeofday() benchmark.
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <assert.h>
#define ITERS 1000000000
static uint64_t gettime(void) {
struct timespec ts;

Keybase proof

I hereby claim:

  • I am yawning on github.
  • I am yawninglol (https://keybase.io/yawninglol) on keybase.
  • I have a public key whose fingerprint is 9EB1 A490 C73C C5D4 4DFB 3E47 BFBD 1C7B 8A6E C81A

To claim this, I am signing this object: