Skip to content

Instantly share code, notes, and snippets.

@charl
charl / main.go
Created November 12, 2014 14:09
go-sql-driver/mysql stalls on locked table access
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/go-sql-driver/mysql"
)
@charl
charl / gist:c7cdc4f08aeec05e8eea
Created August 7, 2014 14:19
Etcd upstart script for process control
description "A highly-available key value store for shared configuration and service discovery"
author "Charl Matthee <[email protected]>"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
@charl
charl / ssdb.conf
Created August 7, 2014 06:45
SSDB upstart script for process management under Ubuntu
description "SSDB - A fast NoSQL database alternative to Redis"
author "Charl Matthee <[email protected]>"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@charl
charl / Script output
Created February 12, 2013 07:43
Encoding::UndefinedConversionError: "\xE3" from ASCII-8BIT to UTF-8
$ jruby ./test.rb
SUCCESS
=======================================================================
Native: {"created_at"=>"Mon Feb 11 16:33:45 +0000 2013", "id"=>301006116974915600, "id_str"=>"301006116974915586", "text"=>"やっとここまできた: ひとりでやるRiak Advent Calendar 2012 day14 - Haskell Client - kuenishi's blog - http://t.co/QXFzD0Sn", "source"=>"<a href=\"http://sites.google.com/site/yorufukurou/\" rel=\"nofollow\">YoruFukurou</a>", "truncated"=>false, "in_reply_to_status_id"=>nil, "in_reply_to_status_id_str"=>nil, "in_reply_to_user_id"=>nil, "in_reply_to_user_id_str"=>nil, "in_reply_to_screen_name"=>nil, "user"=>{"id"=>5576192, "id_str"=>"5576192", "name"=>"UENISHI Kota", "screen_name"=>"kuenishi", "location"=>"Tokyo, Japan", "description"=>"Just got senior: these tweets are my own; forever. WishList http://t.co/50iJIDzM", "url"=>"http://kuenishi.github.com/", "entities"=>{"url"=>{"urls"=>[{"url"=>"http://kuenishi.github.com/", "expanded_url"=>nil, "indices"=>[0, 27]}]}, "description"=>{"urls"=>[{"url"=>"http://
@charl
charl / gist:4500622
Created January 10, 2013 09:06
What is the most efficient way to filter documents with a similar structure to the one below based on the 'expanded_url' key's value. There are two more general questions here: * How do you filter documents based on a nested key(s)? * How do you filter documents based on the value of a key that resolves to an array of objects?
{
"created_at": "Tue, 01 Jan 2013 12:55:09 +0000",
"entities": {
"hashtags": [{
"text": "Clojure",
"indices": [39, 47]
}],
"urls": [{
"url": "http://t.co/ythjuG5U",
"expanded_url": "http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=all&lang=clojure&lang2=java",
@charl
charl / gist:1473622
Created December 13, 2011 20:00
OS X Lion HardwareGrowler crashes when woken up
Process: HardwareGrowler [258]
Path: /Applications/HardwareGrowler.app/Contents/MacOS/HardwareGrowler
Identifier: com.growl.hardwaregrowler
Version: 1.2.2 (1.2.2)
Code Type: X86-64 (Native)
Parent Process: launchd [205]
Date/Time: 2011-12-14 06:36:19.967 +1100
OS Version: Mac OS X 10.7.2 (11C74)