Skip to content

Instantly share code, notes, and snippets.

View wjlroe's full-sized avatar
📷

William Roe wjlroe

📷
View GitHub Profile
module Main (main) where
import Test.Framework
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Your.Module (encrypt, decrypt)
prop_reverseReverse :: [Char] -> Bool
prop_reverseReverse s = (reverse . reverse) s == s
prop_encryptDecrypt :: [Char] -> Bool
(streams
(where (and metric (service "app1")(tagged "sign_in")
; We want to get alerted about failed sign ins. However we expect that there will be failures
; due to incorect passwords etc. So we only want to get alerted if more than 50% of the signins
; in a 60 second period are failures. The app tags failed signins with a warning state.
(fixed-time-window 60
(smap (fn [events]
; count all warnings and count all received events and work out the percentage
(let [percent (/ (count (filter #(= (:state %) "warning") events))
(count events))]
## Rails Upgrade check
#
# Check your github repos for out of date rails apps
#
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ruby railscheck.rb
# or
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ORG=yourorgname ruby railscheck.rb
#
# n.b requires the octokit gem
require 'riak/cluster'
riak_dir_path = File.dirname(File.realdirpath('/usr/local/bin/riak'))
cluster = Riak::Cluster.new(:count => 4, :source => riak_dir_path, :root => "~/mycluster")
cluster.create
cluster.start
cluster.join
@wjlroe
wjlroe / Makefile
Created September 23, 2011 12:42 — forked from stevemohapibanks/minecraft.erl
WIP Minecraft client
ERLC=/usr/local/bin/erlc
ERLCFLAGS=-o
SRCDIR=.
BEAMDIR=./ebin
compile:
$(ERLC) $(ERLCFLAGS) $(BEAMDIR) $(SRCDIR)/*.erl ;
run: compile
erl -pa ./ebin/ -boot start_sasl -s minecraft_server
@wjlroe
wjlroe / haskell-pkg-conf-to-register-script.py
Created August 26, 2011 12:48 — forked from anonymous/haskell-pkg-conf-to-register-script.py
Script to take the output of the package.sh script in haskell-platform and generate a single register.sh script for fpm
#!/usr/bin/python
## -*- mode: python; python-indent: 4; -*-
import glob
import os.path
if __name__ == '__main__':
with open('unregister.sh', 'w') as unreg:
with open('register.sh','w') as reg:
[fd.write("#!/bin/sh\n") for fd in reg,unreg]
@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"
)
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.1
# Switch to 1.9.1 and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.1@rails3