Skip to content

Instantly share code, notes, and snippets.

View wjlroe's full-sized avatar
📷

William Roe wjlroe

📷
View GitHub Profile
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
messages = {}
first_run = true
loop do
#!/bin/env ruby
require 'rubygems'
require 'eventmachine'
def start_nodes(num_nodes, num_messages)
EM.run {
nodes = []
num_nodes.times do
nodes << EM.spawn{|message|
(defmodule hello
(export (start 0) (len 1)))
(defun start ()
(: io format '"Hello World!~n"))
(defun len (l)
(if (== l ()) 0
(+ 1 (len (cdr l)))))
X = fun() ->
lists:foldl(fun(Pid, Acc) ->
case erlang:process_info(Pid,message_queue_len) of
undefined ->
Acc;
{_, Len} ->
if
Len > 3 ->
[{Len, process_info(Pid)} | Acc];
true ->
@wjlroe
wjlroe / ssh_auth
Created January 20, 2011 10:43
Function to help set the ssh auth sock (helps with screen/tmux usage)
function set_current_ssh_auth_sock {
current_ssh_auth_sock=${1:-~/.ssh/current_ssh_auth_sock}
if [ ! -e "$current_ssh_auth_sock" -o -h "$current_ssh_auth_sock" ]
then
if file -L "$current_ssh_auth_sock" >/dev/null
then
SSH_AUTH_SOCK="$current_ssh_auth_sock"
else
rm -f "$current_ssh_auth_sock"
@wjlroe
wjlroe / gist:984988
Created May 21, 2011 23:13 — forked from agl/gist:876829
Proxy server for testing revocation
package main
import (
"encoding/line"
"fmt"
"io"
"net"
"strings"
)
(setq android-mode-sdk-dir "~/android-sdk-mac_86/")
(require 'android-mode)
(require 'java-mode-indent-annotations)
(setq java-mode-hook
(function (lambda()
(java-mode-indent-annotations-setup))))
@wjlroe
wjlroe / cicada.hs
Created August 1, 2011 08:39
Solution to the Cicada problem
module Cicada where
import Data.List (union, intersect)
broodA = [4,8..]
broodB = [6,12..]
broodC = [7,14..]
currentBroods = broodA `union` broodB `union` broodC
@wjlroe
wjlroe / app.clj
Created August 2, 2011 17:44
failing compile with leiningen
(ns riaktest.app
(:import
[com.basho.riak.client RiakFactory]))
(def client (RiakFactory/pbcClient))
(defn -main []
(println "woot"))
@wjlroe
wjlroe / init.clj
Created August 5, 2011 09:39
SSL options for Leiningen
(defn set-ssl
[task & args]
(do
(System/setProperty "javax.net.ssl.trustStoreProvider" "Apple")
(System/setProperty "javax.net.ssl.trustStoreType" "KeychainStore")
(System/setProperty "javax.net.debug" "all")))
(def settings {:hooks [set-ssl]})