Skip to content

Instantly share code, notes, and snippets.

@hank
hank / Makefile
Created November 16, 2012 04:30
Simple Boost.Interprocess Demo
CFLAGS=-O3 -Wall
TARGETS=example1_server example1_client
all: $(TARGETS)
example1_server: example1_server.cpp
$(CXX) $(CFLAGS) -o $@ $<
example1_client: example1_client.cpp
$(CXX) $(CFLAGS) -o $@ $<
@hank
hank / insane_kernel_macro_solution.c
Created April 12, 2012 07:10
The solution to Linus' question on resolving undefined macros in the preprocessor to 0, as well as resolving defined macros to their values.
#include <stdio.h>
#define CONFIG_FOO 1
#define CONFIG_NOO 0
#define is_set(macro) is_set_(macro)
#define macrotest_1 ,
#define is_set_(value) is_set__(macrotest_##value)
#define is_set__(comma) is_set___(comma 1, 0)
#define is_set___(_, v, ...) v
7B 5C 72 74 66 31 5C 63 70 67 34 33 37 20 5C 64
65 66 66 31 7B 5C 66 6F 6E 74 74 62 6C 7B 5C 66
31 5C 66 6D 6F 64 65 72 6E 5C 66 70 72 71 31 5C
66 63 68 61 72 73 65 74 30 20 43 6F 75 72 69 65
72 20 4E 65 77 3B 7D 7D 7B 5C 63 6F 6C 6F 72 74
62 6C 3B 5C 72 65 64 30 30 5C 67 72 65 65 6E 30
30 5C 62 6C 75 65 30 30 3B 5C 72 65 64 32 30 35
5C 67 72 65 65 6E 30 30 5C 62 6C 75 65 30 30 3B
5C 72 65 64 30 30 5C 67 72 65 65 6E 32 30 35 5C
62 6C 75 65 30 30 3B 5C 72 65 64 32 30 35 5C 67

Keybase proof

I hereby claim:

  • I am hank on github.
  • I am egregg (https://keybase.io/egregg) on keybase.
  • I have a public key ASCcmls8PCg6OVvVlQ8nwWK4vkaaX3-RwA0TbWwKXDB7Two

To claim this, I am signing this object:

Year-Make-Model-Trim-Tranny-Weight
1985 Honda CRX Si MT 1883
1985 Honda CRX DX MT 1819
1985 Honda CRX HF MT 1713
1986 Honda CRX Si MT 1953
1986 Honda CRX DX MT 1819
1986 Honda CRX HF MT 1713
1987 Honda CRX Si MT 1978
1987 Honda CRX DX MT 1865
1987 Honda CRX HF MT 1713
@hank
hank / keymap.xml
Created March 31, 2018 15:34
Keymap for Rii MX3 on RasPlex
<keymap>
<global>
<keyboard>
<home>Back</home>
</keyboard>
<mouse>
<leftclick>Select</leftclick>
<rightclick>Back</rightclick>
<middleclick>noop</middleclick>
<doubleclick>noop</doubleclick>
@hank
hank / .config
Created November 19, 2017 22:36
config-4.4.9-rt17-i686-ion-v1
# Linux/x86 4.4.9 Kernel Configuration
#
# * Enabled NVidia ION support
# * Enabled Soundgraph ION controller
# * Enabled Atheros ath9k support
# * Enabled ZyXEL ZD1201 USB WiFi support
# CONFIG_64BIT is not set
CONFIG_X86_32=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
@hank
hank / mdshooters_rss.rb
Created August 23, 2009 14:46
Provides code to generate a feed of classified ads
require 'rubygems'
require 'open-uri'
require 'hpricot'
require 'rss/maker'
version = "2.0"
destination = "mdshooters_classifieds.xml"
content = RSS::Maker.make(version) do |m|
m.channel.title = "MDShooters Classifieds RSS"
"api-allow" : "W:192.168.0.0/16",
"intensity" : "20",
"gpu-engine" : "1090",
"worksize" : "256",
"gpu-memclock" : "1860",
"gpu-powertune" : "0",
"temp-cutoff" : "95",
"temp-overheat" : "85",
"temp-target" : "78",
"auto-fan" : true,
@hank
hank / control_probe.c
Created January 20, 2013 06:36
A little program I wrote for a class.
/* Project: Module 12 Assignment
*
* Program: control_probe
* File Name: control_probe.c
* Purpose: Connect to a shared memory area and a probe guidance server, and
* command a probe to map the given cavern using simple network commands. The
* algorithm at work uses a recursive depth-first search, which uses a fair
* bit of memory for the stack, but usually solves a cavern in 10-13 seconds
* on aplcenmp, and doesn't invoke a single lawsuit in the first 50 caverns
* tested.