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
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 |
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
(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))] |
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
## 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 |
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 '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 |
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
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 |
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
#!/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] |
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
package main | |
import ( | |
"encoding/line" | |
"fmt" | |
"io" | |
"net" | |
"strings" | |
) |
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
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 |