Skip to content

Instantly share code, notes, and snippets.

@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
@hank
hank / gist:1653778
Created January 21, 2012 20:07
CSP Wishes
*.github.com/api
*.github.com/images
@hank
hank / .htaccess
Created January 21, 2012 20:03
X-Content-Security-Policy
Header set X-Content-Security-Policy "default-src 'self'; \
options inline-script eval-script; \
allow *.ralree.com *.ralree.info \
*.flickr.com \
github.com \
*.github.com \
https://*.github.com \
*.google.com \
https://*.google.com \
*.google-analytics.com \
@hank
hank / fusionrunnerdump.py
Created January 20, 2012 07:47
FusionRunner Data Dumper
#!/usr/bin/python
""" FusionRunner
Queries Google Fusion Tables for MyTracks data.
"""
__author__ = 'hardware.hank@gmail.com (Erik Gregg)'
import sys, getpass
sys.path.append("./fusion-tables-client-python-read-only/src/")
from authorization.oauth import OAuth
from sql.sqlbuilder import SQL
@hank
hank / fusionrunner.py
Created January 19, 2012 07:13
FusionRunner
#!/usr/bin/python
""" FusionRunner
Queries Google Fusion Tables for MyTracks data.
"""
__author__ = 'hardware.hank@gmail.com (Erik Gregg)'
### IMPORTS ###
import sys
sys.path.append("./fusion-tables-client-python-read-only/src/")
sys.path.append("./httplib2/python2")
@hank
hank / walkdata.txt
Created January 19, 2012 07:02
Walk Data
name,description,geometry,marker
1/16/12 7:08 PM (Start),,"<Point><coordinates>-76.827712,39.145476,29.299999237060547</coordinates></Point>",large_green
1/16/12 7:08 PM,,"<LineString><coordinates>-76.827712,39.145476,29.299999237060547 -76.827793,39.145555,52.400001525878906 -76.828042,39.145564,50.29999923706055 -76.828234,39.14553,57.099998474121094 -76.828334,39.145481,62.0 -76.828657,39.145497,61.0 -76.828961,39.145379,57.20000076293945 -76.829609,39.145241,61.70000076293945 -76.829702,39.145303,62.29999923706055 -76.829716,39.14545,59.099998474121094 -76.829961,39.146307,61.099998474121094 -76.829587,39.146508,62.900001525878906 -76.829498,39.146808,57.900001525878906 -76.829083,39.146878,54.29999923706055 -76.829038,39.146918,56.79999923706055 -76.829025,39.146975,58.79999923706055 -76.828927,39.147039,55.099998474121094 -76.828963,39.147192,56.099998474121094 -76.828818,39.14734,58.900001525878906 -76.828741,39.14737,60.20000076293945 -76.828627,39.147375,61.20000076293945 -76.828436,39.147316,59.9000
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1yDQCZLjxcIhepbNiPNPcM2qlEVEHNfaNswzVla0gZ3ULeTi+5CHcaEu1Po3LWLpVH9Ru7PvMhs5gl+r/aUmhLn/ymg1aKimpOrxJXbygyMXdMsjoHzhpBwLG7WbWSJ5Kon47heXeMZCHD7X6C8MbW2DIj/PSGW2LFcFwI5qpz7KZGQmZ3FVZaDIWOU3xpBZFFjT/OXAS9ZySYM6aR5h660RKX4PDR4txuHM+QEyYeBmhIJgHIoyTQnLtI2Yb5vEOwnHF4yiXwXBQ30LurhYWKAzDw9+RSAr3t5TSyFtAag9Jr7rCcwg9/fnSHVW6z11MmOuHyL0OwwNFxu4Bfmjyw== hank@tardis
@hank
hank / SConstruct
Created April 3, 2011 17:52
Builds a LXPanel plugin
env = Environment(
LIBPREFIX = "",
)
# Grab all the pkg-config stuff.
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
conf = Configure(env)
if not conf.CheckLib("cairo"):
print 'Could not find cairo library.'
section: screens
tardis:
impulse:
end
section: links
tardis:
down = impulse
impulse:
up = tardis
all:
g++ -o test test.cpp