Skip to content

Instantly share code, notes, and snippets.

-define(TIMEOUT, 60000).
-behavior(ssh_channel).
%% API
-export([start_link/2, send/2, send_wait/2, close/1, get_data/1]).
%% ssh_channel API
-export([init/1, handle_call/3, handle_cast/2, handle_msg/2]).
-export([handle_ssh_msg/2, code_change/3, terminate/2]).
@Vagabond
Vagabond / delete_bug.erl
Created May 10, 2011 21:00
Riak delete bug bz://260
-module(delete_bug).
-compile([export_all]).
start(N) ->
{ok, C} = riak:local_client(),
C:set_bucket(<<"b">>, [{allow_mult, false}]),
loop(N, C).
start_pbc(N) ->
{ok, RC} = riakc_pb_socket:start_link("127.0.0.1", 8087),
@ianloic
ianloic / git-prompt.zsh
Created June 25, 2011 19:55
Showing the Git module and status
setopt prompt_subst
autoload colors zsh/terminfo
colors
function __git_prompt {
local DIRTY="%{$fg[yellow]%}"
local CLEAN="%{$fg[green]%}"
local UNMERGED="%{$fg[red]%}"
local RESET="%{$terminfo[sgr0]%}"
git rev-parse --git-dir >& /dev/null
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@jonifreeman
jonifreeman / gist:1306258
Created October 22, 2011 17:35
Port of submit.m Octave functionality to Haskell
import System.IO
import Control.Exception
import Numeric.LinearAlgebra
import Data.Digest.Pure.SHA
import Data.ByteString.Lazy.Char8 as BS8 (pack)
import Data.List (sort)
import System.Random (randomRIO)
import Network.Curl
import Text.Printf (printf)
import Data.List.Split (splitOn)
@bryanhunter
bryanhunter / build-erlang-r15b.sh
Created January 12, 2012 20:52
Build Erlang R15B on a fresh Ubuntu box (tested on Ubuntu 11.10)
#!/bin/bash
# Pull this file dowm, make it executable and run it with sudo
# wget https://raw.github.com/gist/1603037/build-erlang-r15b.sh
# chmod u+x build-erlang-r15b.sh
# sudo ./build-erlang-r15b.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
@yosemitebandit
yosemitebandit / key-fingerprint
Created March 7, 2012 18:27
view your ssh public key's fingerprint; compare this to what Github has listed in the ssh key audit
$ ssh-keygen -l -f /path/to/keys/id_rsa.pub
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA)
@jlouis
jlouis / annealing.erl
Created April 25, 2012 18:46
Anneal y = (X + 4)(X + 1)(X -2) / 4 :)
-module(annealing).
-export([anneal/1]).
-define(KMAX, 10000).
-define(EMAX, 0.00001).
-define(INITIAL_TEMP, 100000).
anneal(S0) ->
random:seed(os:timestamp()),
@jlouis
jlouis / annealing.erl
Created April 27, 2012 20:29
Anneal y = (X + 4)(X + 1)(X -2) / 4 -- in parallel.
-module(annealing).
-export([anneal/1, anneal/2]).
-define(KMAX, 2500).
-define(EMAX, 0.00001).
-define(INITIAL_TEMP, 100000).
anneal(S0) ->
anneal(S0, 4).
@jlouis
jlouis / annealing.erl
Created April 28, 2012 20:13
Improved parallel scheme, introduce more advanced temp function.
-module(annealing).
-export([anneal/1, anneal/2]).
-define(KMAX, 1000).
-define(EMAX, 0.00001).
-define(GRACE, 500).
anneal(S0) ->
anneal(S0, 4).