Skip to content

Instantly share code, notes, and snippets.

@durango
durango / ev.rb
Created August 21, 2011 00:15 — forked from dkubb/ev.rb
Poor-man's Embedded Value
class User
include DataMapper::Resource
property :id, Serial
property :username, String, :required => true, :unique => true
property :address_street_address, String
property :address_location, String
property :address_subdivision, String
property :address_country, String
@durango
durango / about.md
Created August 21, 2011 18:59 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
==> ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.1-1 --enable-shared --disable-stati
==> make install
/bin/sh ./config/mkinstalldirs . ltdl/
cp ./ltdl/argz_.h ltdl/argz.h-t
mv ltdl/argz.h-t ltdl/argz.h
make install-am
CC ltdl/argz.lo
/bin/sh ./libtool --silent --tag=CC --mode=compile /usr/bin/cc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I./config -I. -I. -DLT_CONFIG_H='<config/config.h>' -DLTDL -I. -I. -Iltdl -I./ltdl -I./ltdl/libltdl -I./Magick++/lib -I/usr/X11/include/freetype2 -I/usr/X11/include -I/usr/X11/include -I/usr/include/libxml2 -D_THREAD_SAFE -D_THREAD_SAFE -pthread -fopenmp -march=core2 -msse4.1 -w -pipe -O3 -Wall -D_THREAD_SAFE -pthread -c -o ltdl/argz.lo ltdl/argz.c
CC coders/coders_art_la-art.lo
/bin/sh ./libtool --silent --tag=CC --mode=compile /usr/bin/cc -std=gnu99 -std=gnu99 -DHAVE_CONFIG_H -I. -I./config -I/usr/X11/include/freetype2 -I/usr/X11/include -I/usr/X11/include -I/usr/include/libxml2 -D_THREAD_SAFE -D_
# What I expect...
~ (0.000454) SELECT `id`, `message`, `date_posted`, `last_edited`, `last_edited_by`, `player_id`, `forum_board_id`, `forum_topic_id` FROM `forum_replies` WHERE `forum_topic_id` IN (3, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 57, 54, 51, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36) ORDER BY `id` DESC
~ (0.000309) SELECT `id`, `name`, `user_id`, `active`, `age`, `level`, `life`, `strength`, `dexterity`, `intelligence`, `luck`, `bank`, `exp`, `energy`, `gender`, `wins`, `losses`, `stales`, `clan`, `last_killed`, `last_killedby`, `date_created`, `last_macro`, `macro_points`, `energy_refills`, `points`, `char_class`, `last_active`, `guild_id`, `forum_topic_id`, `forum_reply_id` FROM `players` WHERE `id` IN (1,2) LIMIT 1
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@durango
durango / php-cgi.rb
Created September 3, 2011 02:04 — forked from ambethia/php-cgi.rb
Homebrew Formula for PHP 5.2.14 as php-cgi (for nginx, etc.)
# Homebrew Formula for PHP 5.2.14 as php-cgi (for nginx, etc.)
require 'formula'
class PhpCgi <Formula
@url='http://www.php.net/get/php-5.2.14.tar.bz2/from/www.php.net/mirror'
@version='5.2.14'
@homepage='http://php.net/'
@md5='bfdfc0e62fe437020cc04078269d1414'
@durango
durango / google_speech_recognition.rb
Created December 11, 2011 15:33 — forked from pachacamac/google_speech_recognition.rb
google speech recognition with ruby
require 'rest_client'
require 'json'
a = `sox -d --norm -t .flac - silence -l 1 0 1% 1 6.0 1% rate 16k`
#a = `arecord -q -d 3 -c 1 -f S16_LE -r 22050 -t wav | flac - -f --totally-silent -o-`
r = RestClient.post 'https://www.google.com/speech-api/v1/recognize?lang=en-US', a,
:content_type => 'audio/x-flac; rate=16000'
if j = JSON.parse(r)
(p j; `espeak 'you said: #{j['hypotheses'].first['utterance']}'`)
end
@durango
durango / dh-usage.js
Created February 5, 2012 17:45 — forked from bellbind/dh-usage.js
[nodejs][javascript] Diffie-Hellman key exchange by nodejs-0.5
// node.js 0.5 Diffie-Hellman example
var assert = require("assert");
var crypto = require("crypto");
// the prime is shared by everyone
var server = crypto.createDiffieHellman(512);
var prime = server.getPrime();
// sharing secret key on a pair
@durango
durango / client.js
Created February 10, 2012 04:56 — forked from sbusso/client.js
Node + ZeroMQ + Redis
var zmq = require('zeromq');
s = zmq.createSocket('push');
s.connect('tcp://127.0.0.1:15000');
while (true) { // ZOMG he did it again!
s.send(new Buffer("test"));
}
@durango
durango / hack.sh
Created March 31, 2012 17:58 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2267151/hack.sh | sh
#