Skip to content

Instantly share code, notes, and snippets.

@hank
hank / insane_kernel_macro_solution.c
Created Apr 12, 2012
The solution to Linus' question on resolving undefined macros in the preprocessor to 0, as well as resolving defined macros to their values.
View insane_kernel_macro_solution.c
#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
View gist:1653778
*.github.com/api
*.github.com/images
@hank
hank / .htaccess
Created Jan 21, 2012
X-Content-Security-Policy
View .htaccess
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 Jan 20, 2012
FusionRunner Data Dumper
View fusionrunnerdump.py
#!/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
View fusionrunner.py
#!/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")
View walkdata.txt
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
View gist:933388
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1yDQCZLjxcIhepbNiPNPcM2qlEVEHNfaNswzVla0gZ3ULeTi+5CHcaEu1Po3LWLpVH9Ru7PvMhs5gl+r/aUmhLn/ymg1aKimpOrxJXbygyMXdMsjoHzhpBwLG7WbWSJ5Kon47heXeMZCHD7X6C8MbW2DIj/PSGW2LFcFwI5qpz7KZGQmZ3FVZaDIWOU3xpBZFFjT/OXAS9ZySYM6aR5h660RKX4PDR4txuHM+QEyYeBmhIJgHIoyTQnLtI2Yb5vEOwnHF4yiXwXBQ30LurhYWKAzDw9+RSAr3t5TSyFtAag9Jr7rCcwg9/fnSHVW6z11MmOuHyL0OwwNFxu4Bfmjyw== hank@tardis
@hank
hank / SConstruct
Created Apr 3, 2011
Builds a LXPanel plugin
View SConstruct
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.'
View gist:716101
section: screens
tardis:
impulse:
end
section: links
tardis:
down = impulse
impulse:
up = tardis
View Makefile
all:
g++ -o test test.cpp