Skip to content

Instantly share code, notes, and snippets.

Henry Donnay hdonnay

Block or report user

Report or block hdonnay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BUILD.nasm
genrule(
name = "nasm.bin",
srcs = glob(["**/*"]),
outs = ["nasm"],
executable = True,
cmd = """
cd external/nasm
./configure
make nasm
install -vDm 0755 nasm $(@)
View noise.sh
#!/bin/sh
exec 2>/dev/null
exec sox -c 2 -n -d synth pinknoise band -n 2500 4000 tremolo 0.03 5 reverb 20 gain -l 6
@hdonnay
hdonnay / api.go
Last active Mar 27, 2018
logger idea
View api.go
package tlog
// import (...)
func WithTags(ctx context.Context, pairs ...string) context.Context {
// turn these pairs into a bunch of [][2]string, shove into the Context
}
func Print(ctx context.Context, f string, v ...interface{}) {
tags := fromContext(ctx)
View keybase.md

Keybase proof

I hereby claim:

  • I am hdonnay on github.
  • I am hdonnay (https://keybase.io/hdonnay) on keybase.
  • I have a public key whose fingerprint is 5989 62F6 8B4F 9428 F27F 43D1 82E2 1E8C 09B4 BE6D

To claim this, I am signing this object:

@hdonnay
hdonnay / work.c
Created Oct 13, 2017
work (nix-shell wrapper)
View work.c
#define _XOPEN_SOURCE 700
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
extern char **environ;
@hdonnay
hdonnay / tls-hook.sh
Last active Jan 10, 2017
acmetool tls-sni hook
View tls-hook.sh
#!/bin/sh
# Provided in the public domain.
#
# This works best as a suid hook.
# nginx may complain about the server_name being too long. Either fix it, or
# the commented out pattern should work.
NGINX_SITES=/etc/nginx/sites-enabled
cfg="$NGINX_SITES/challenge-$2"
pem="${TMPDIR:-/tmp}/challenge-$2.pem"
@hdonnay
hdonnay / gdb
Created Oct 12, 2016
gdbserver work
View gdb
% gdb amd64/bin/cat
GNU gdb (GDB; openSUSE Tumbleweed) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
View diff.go
// This is something like n^2 worst-case.
//
// []string must be sorted
func diffStrings(new, old []string) (added, removed []string) {
Add:
for _, x := range new {
for _, y := range old {
if x == y {
continue Add
}
@hdonnay
hdonnay / mk_freeze.sh
Last active Dec 18, 2015
Helper script to use esky with salt
View mk_freeze.sh
#!/bin/sh
trap '[ -f patch.$$ ] && patch -R < patch.$$' 0
PATH="$PATH:`pwd`/patchelf/src"
set -e
#exec >/dev/null
[ -f setup.py ] || { printf "You seem to be in the wrong directory.\n"} >&2; exit 1; }
if ! which patchelf >/dev/null 2>&1; then
printf "Couldn't find 'patchelf', going to download and compile.\n" >&2
git clone https://github.com/NixOS/patchelf
(
@hdonnay
hdonnay / ht.sh
Last active Dec 14, 2015
ht, a hashtable in sh
View ht.sh
#!/bin/sh
VERSION='1.0.2'
usage() {
cat >&2 <<EOF
$(basename $0) -- $VERSION
USAGE:
$(basename $0) [-r] [-d dir] { -o | [-v] KEY }
If stdin is attached, it will be inserted into key KEY. If it's not,
You can’t perform that action at this time.