This file contains hidden or 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 | |
| # companion to create_vbox_vm.sh, clones an existing VM w/o graphical interface. | |
| # used to provision quick images for a hadoop project. | |
| export VMPATH=~/Library/VirtualBox/Machines/ | |
| export HDDPATH=~/Library/VirtualBox/HardDisks/ | |
| if [ "$#" -lt 2 ]; then | |
| echo "use as clonevm <originalVM> <newVM>" |
This file contains hidden or 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
| %% base62 encoding - initial idea based on riak's encoding, with no if's and fixed base | |
| %% http://hg.basho.com/riak/src/661615e510dd/src/riak_util.erl | |
| %% gleicon - 2010 | |
| -module(base62). | |
| -export([base62range/2, base62range/1]). | |
| range(I) when I >= 36 -> I-36+$a; | |
| range(I) when I >= 10 -> I-10+$a; |
This file contains hidden or 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
| %% base62 encoding - initial idea based on riak's encoding, with no if's and fixed base | |
| %% this time its not so idiomatic, but makes decoding possible. | |
| %% | |
| %% gleicon - 2010 | |
| %% | |
| %% testing: | |
| %% 0> c(base62.erl). | |
| %% 1> base62:decode(base62:encode(1000)) == 1000. | |
| %% |
This file contains hidden or 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
| %% base62 encoding - initial idea based on riak's encoding, with no if's and fixed base | |
| %% gleicon - 2010 | |
| %% | |
| %% testing: | |
| %% 0> c(base62.erl). | |
| %% 1> base62:decode(base62:encode(1000)) == 1000. | |
| %% charlist removed thanks to freenode's #erlang | |
| %% | |
| -module(base62). |
This file contains hidden or 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
| %% gleicon - 2010 | |
| %% | |
| %% testing: | |
| %% 0> c(base62.erl). | |
| %% 1> base62:decode(base62:encode(1000)) == 1000. | |
| %% rvirding-fication of the original code. | |
| %% | |
| -module(base62). | |
| -export([encode/1, decode/1]). |
This file contains hidden or 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
| -module(httpclient). | |
| -export([start/2, timer/2, recv/1]). | |
| start(Filename, Wait) -> | |
| inets:start(), | |
| spawn(?MODULE, timer, [10000, self()]), | |
| This = self(), | |
| spawn(fun()-> loadurls(Filename, fun(U) -> This ! {loadurl, U} end, Wait) end), | |
| recv({0,0,0}). |
This file contains hidden or 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
| # sinatra/thin based proxy | |
| require 'rubygems' | |
| require 'sinatra' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'redis' | |
| reddo = Redis.new | |
| get '/url/*' do | |
| url = params["splat"].to_s |
This file contains hidden or 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
| # sinatra/thin based proxy | |
| require 'rubygems' | |
| require 'sinatra' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'redis' | |
| require 'digest/md5' | |
| $KCODE = 'u' if RUBY_VERSION < '1.9' | |
| before do |
This file contains hidden or 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
| # minimal async sinatra app | |
| # requires ruby 1.9.x | |
| require 'sinatra' | |
| require 'em-http' | |
| require 'em-synchrony' | |
| require 'em-synchrony/em-http' | |
| require 'rack/fiber_pool' | |
| use Rack::FiberPool |
This file contains hidden or 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
| var net = require('net'); | |
| var sys = require('sys'); | |
| function repr(wot) { | |
| sys.puts(sys.inspect(wot)); | |
| } | |
| net.createServer(function (socket) { | |
| //repr(socket); | |
| client = net.createConnection(8888); |