This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
koronen@paridae$ prolog | |
GNU Prolog 1.3.0 | |
By Daniel Diaz | |
Copyright (C) 1999-2007 Daniel Diaz | |
| ?- consult('puzzle.pl'). | |
compiling /home/koronen/puzzle.pl for byte code... | |
/home/koronen/puzzle.pl compiled, 5 lines read - 608 bytes written, 11 ms | |
yes | |
| ?- puzzle([]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rake' | |
gem 'sinatra' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 APP" >&2 | |
exit 1 | |
fi | |
app="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.crt | |
*.key | |
*.log | |
*.pem | |
*.req | |
.vagrant/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
n = 2000000 | |
Benchmark.bm do |x| | |
arr = 1.upto(1000).to_a | |
x.report('<<') do | |
1.upto(n) do |i| | |
arr << i | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print statistics | |
failures = Resque::Failure.all(0, -1).each_with_index.map { |ex, i| ex['id'] = i; ex }; nil | |
fbe = Hash.new { |h, k| h[k] = Array.new } | |
fbc = Hash.new { |h, k| h[k] = Array.new } | |
failures.each { |ex| fbe[ex['exception']] << ex; fbc[ex['payload']['class']] << ex }; nil | |
puts fbe.map { |e,jj| [e, jj.size] }.inspect | |
puts fbc.map { |e,jj| [e, jj.size] }.inspect | |
# Dump failures as JSON | |
failures = Resque::Failure.all(0, -1).each_with_index.map { |ex, i| ex['id'] = i; ex }; nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise-server-amd64" | |
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id" : "2065201419", | |
"type" : "CreateEvent", | |
"actor" : { | |
"id" : 6863681, | |
"login" : "sdwalsh", | |
"gravatar_id" : "e2256e5595d65aba76579e24c1977905", | |
"url" : "https://api.github.com/users/sdwalsh", | |
"avatar_url" : "https://avatars.githubusercontent.com/u/6863681?", | |
"location": "Stockholm, Sweden", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://docs.mongodb.org/manual/core/map-reduce/ | |
// $ tail -f /var/log/mongodb/mongodb.log | |
var map = function(){ | |
print("map"); | |
emit(1, 2); | |
}; | |
var reduce = function(key, values){ | |
print("reduce"); | |
return Array.sum(values); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'nokogiri', '~> 1.6' | |
end | |
require 'csv' | |
require 'date' |