Skip to content

Instantly share code, notes, and snippets.

prefix=TPL_PREFIX
major_version=5.2
version=5.2.3
lib_name=lua
libdir=${prefix}/lib
includedir=${prefix}/include
#
# The following are intended to be used via "pkg-config --variable".
@cyx
cyx / foo.md
Created October 22, 2013 23:34
$ hello
@cyx
cyx / mp
Created October 22, 2013 21:00
#!/usr/bin/env ruby
require 'json'
require 'msgpack'
data = JSON.parse($stdin.read)
$stdout.write(data.to_msgpack)
require "benchmark"
require "msgpack"
require "json"
N = Integer(ARGV[0] || 10000)
data = { 'hello' => { 'there' => 'peeps' },
'yes' => [1, 2, 3],
'no' => true, 'bam' => false }
@cyx
cyx / foo.diff
Created October 3, 2013 01:28 — forked from oren/gist:6803198
diff --git a/tests/models/listing_test.js b/tests/models/listing_test.js
index 14c3d14..c04b7a6 100644
--- a/tests/models/listing_test.js
+++ b/tests/models/listing_test.js
@@ -10,6 +10,7 @@ var dict = {
'Name': 'CPK',
'HeadingText': 'Restaurants',
'PrimaryCollection': 'food',
+ 'Personalization.TotalNotes': '10'
};
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /home/t/nginx/conf/mime.types;
default_type application/octet-stream;
console.log(new Buffer("Hello World").toString('base64'));
// => "SGVsbG8gV29ybGQ="
console.log(new Buffer("SGVsbG8gV29ybGQ=", 'base64').toString('ascii'))
// => "Hello World"
@cyx
cyx / benchmark.rb
Last active December 17, 2015 10:18
Experimental thoughts on the ruby way of doing parameters.
require 'benchmark'
require 'rack'
require 'json'
payload = {
'user' => {
'a' => '1', 'b' => '2',
'comments' => [
{ 'body' => 'Hello' },
{ 'body' => 'World' }
Dir["*.NEF"].each do |file|
# Since you don't really get to display the raw quality,
# we save ourselves bandwidth and reduce to something reasonable,
# in this case 2520x2160.
puts `gm convert -resize '2520X2160>' #{file} #{file.gsub(".NEF", ".JPG")}`
end
@cyx
cyx / gist:5241445
Created March 25, 2013 22:31 — forked from gonz/gist:1686815
import re, sys
keys = ('abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz')
m = dict((l, str(n)) for n, letters in enumerate(keys, start=2) for l in letters)
data, ocurrences = {}, {}
wmatch = re.compile('[^a-z]+')
def learn(word):
num = ''.join(m[c] for c in word)
for i in xrange(1, len(word) + 1):