I hereby claim:
- I am eterps on github.
- I am eterps (https://keybase.io/eterps) on keybase.
- I have a public key ASBdMN2hfTUxgMovEIPOEH4e9qAXplhPeYciuLAl2LnMKwo
To claim this, I am signing this object:
require 'openssl' | |
require 'digest/sha1' | |
require 'base64' | |
class Encryption | |
def self.encrypt(src, key, cipher = 'aes-256-cbc') | |
c = OpenSSL::Cipher::Cipher.new(cipher) | |
c.encrypt | |
c.key = Digest::SHA1.hexdigest(key) | |
e = c.update(src) |
class DirTree < String | |
include Enumerable | |
def each | |
Dir.entries(self).reject{|n| %w[. ..].include? n}.each do |filename| | |
yield path = "#{self}/#{filename}" | |
DirTree.new(path).each{|n| yield n} if File.directory? path | |
end | |
end | |
end |
Install node.js: | |
# See: http://nodejs.org/#download | |
NJSVERSION=v0.2.4 | |
cd ~/tmp && wget http://nodejs.org/dist/node-${NJSVERSION}.tar.gz && tar zxf node-${NJSVERSION}.tar.gz && cd node-${NJSVERSION} | |
./configure --prefix=/opt/node-${NJSVERSION} && make && make install && ln -s /opt/node-${NJSVERSION} /opt/node | |
ln -s /opt/node/bin/node ~/bin/node | |
vi .bashrc | |
.. | |
export PATH=$PATH:/opt/node/bin |
#!/usr/bin/env ruby | |
class MRISC | |
def run(code) | |
tokens = code.gsub(/(\*.*?\*)|[^a-z0-9,-;@\._]/,'').split(';') | |
@vars,stack,i = {:_pc=>-1,:_oc=>0},[],0 | |
tokens.map!{|t| t.chars.first=='@' ? (@vars[t.to_sym]=i-1;nil) : (i+=1;t.split(',').map{|e|numeric?(e) ? e.to_i : e.to_sym})}.compact! | |
while @vars[:_pc] < tokens.size-1 | |
@vars[:_pc] += 1 | |
@vars[:_oc] += 1 |
Gem::Specification.new do |s| | |
s.name = 'open-s3uri' | |
s.version = '0.1.0' | |
s.platform = Gem::Platform::RUBY | |
s.author = 'Erik Terpstra' | |
s.email = '[email protected]' | |
s.summary = 'Opens an S3 uri' | |
s.description = 'Opens an S3 uri like open-uri does for http URLs' | |
s.files = ['open-s3uri.rb'] |
require 'webmachine/adapters/rack' | |
require_relative 'webservice' | |
run Webservice.adapter |
backend s3 { .host = "s3.amazonaws.com"; .port = "80"; } | |
sub vcl_recv { | |
if (req.url ~ ".(css|gif|ico|jpg|jpeg|js|png|swf|txt)$") { | |
unset req.http.cookie; | |
unset req.http.cache-control; | |
unset req.http.pragma; | |
unset req.http.expires; | |
unset req.http.etag; | |
unset req.http.X-Forwarded-For; |
# From Confident Ruby, page 72 | |
module Graphics | |
module Conversions | |
module_function | |
def Point(*args) | |
case args.first | |
when Point then args.first | |
when Array then Point.new(*args.first) |
I hereby claim:
To claim this, I am signing this object:
require 'yaml' | |
class Storage # Normally should be Redis or Kafka? | |
def self.events | |
@events ||= [] | |
end | |
end | |
# Aggregates (models) |