Skip to content

Instantly share code, notes, and snippets.

@JerrySievert
JerrySievert / make
Created July 18, 2012 03:40
Redis on Raspberry Pi
jerry@pi:/tmp/redis-2.4.15$ make -j 2
cd src && make all
make[1]: Entering directory `/tmp/redis-2.4.15/src'
MAKE hiredis
MAKE jemalloc
make[2]: Entering directory `/tmp/redis-2.4.15/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
checking for xsltproc... no
checking for gcc... gcc
checking whether the C compiler works... yes
@JerrySievert
JerrySievert / gist:3239103
Created August 2, 2012 17:51
raspberry pi node
root@raspberrypi:~/node/out/Release# ldd ./node
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0x40311000)
libssl.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.0.0 (0x401bd000)
libcrypto.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (0x4031a000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x4007b000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x400f2000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x4020c000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x400fd000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x4016e000)
function(msg) {
if(/^taps/.test(msg.message)) {
var match = msg.message.match(/^taps\s+(.+)/);
var tap;
var taps = [ ];
json = http.get("http://visualizeapi.com/api/baileys");
feed = JSON.parse(json);
var tap_list = "Bailey's Taps: ";
@JerrySievert
JerrySievert / gist:3659672
Created September 6, 2012 19:19
incorrect safari try/catch behavior?
var err = function (m) {
throw {
m: m
};
};
try {
err("foo");
} catch (e) {
console.dir(e);
@JerrySievert
JerrySievert / triggers
Created November 14, 2012 00:24
trigger issue
DROP TABLE test_table CASCADE;
CREATE TABLE test_table (
id SERIAL PRIMARY KEY,
data VARCHAR
);
CREATE TABLE test_table_part () INHERITS (test_table);
CREATE OR REPLACE FUNCTION test_trigger_pre () RETURNS TRIGGER AS $$
@JerrySievert
JerrySievert / gist:4247487
Created December 9, 2012 23:27
temperature from raspberry pi
#!/usr/bin/env node
var fs = require('fs');
function getTemperature (device) {
fs.readFile('/sys/bus/w1/devices/' + device + '/w1_slave', 'utf8', function (err, data) {
var output = data.match(/t=(\d+)/);
var calc = output[1] / 1000;
{"type":"MultiPolygon","coordinates":[[[[-123.00111,37.772053],[-122.997538,37.770784],[-122.99509,37.769131],[-122.987414,37.76387],[-122.981429,37.758916],[-122.977596,37.754976],[-122.975448,37.752585],[-122.974061,37.749929],[-122.973256,37.748652],[-122.970449,37.747818],[-122.967271,37.746303],[-122.964099,37.744281],[-122.961057,37.741955],[-122.958391,37.739734],[-122.95464,37.736827],[-122.949985,37.732187],[-122.945523,37.725314],[-122.942294,37.721057],[-122.939711,37.71535],[-122.937917,37.709956],[-122.937679,37.709241],[-122.935865,37.702459],[-122.93571,37.697618],[-122.937339,37.69093],[-122.939026,37.686544],[-122.939661,37.682353],[-122.941364,37.67658],[-122.945009,37.669773],[-122.949068,37.663377],[-122.954876,37.658348],[-122.963006,37.651984],[-122.973012,37.646581],[-122.980513,37.6439],[-122.986747,37.641783],[-122.992589,37.641016],[-123.000912,37.63993],[-123.00111,37.63983],[-123.00111,37.641775],[-123.011605,37.641506],[-123.027153,37.645221],[-123.040696,37.650328],[-123.05358,37

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@JerrySievert
JerrySievert / gist:5686037
Created May 31, 2013 16:06
esri json to geojson
work=# select esriToGeoJSON('{"rings":[[[100,0],[101,0],[101,1],[100,1],[100,0]]],"spatialReference":{"wkid":4326}}');
esritogeojson
------------------------------------------------------------------------------
{"type":"Polygon","coordinates":[[[100,0],[101,0],[101,1],[100,1],[100,0]]]}
@JerrySievert
JerrySievert / gist:5686043
Created May 31, 2013 16:08
geojson to esri json
work=# select geoJSONToEsri('{ "type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
]
}', '{ "wkid": 4326 }');
geojsontoesri
--------------------------------------------------------------------------------
--------
{"rings":[[[100,0],[101,0],[101,1],[100,1],[100,0]]],"spatialReference":{"wkid"