Skip to content

Instantly share code, notes, and snippets.

View practice.rs
fn main() {
println!("hello world!");
let foo = format!("hello rustacean!");
println!("{}", foo);
let x = 5 + 10;
println!("x is {}", x);
#[allow(unused_variables)]
let y: i32 = 42;
@abhijith
abhijith / .screenrc
Created May 19, 2016 — forked from joaopizani/.screenrc
A killer GNU Screen Config
View .screenrc
# the following two lines give a two-line status, with the current window highlighted
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# huge scrollback buffer
defscrollback 5000
# no welcome message
startup_message off
View sums-to-n.clj
;; Without using partial
(defn sums-to-n? [n]
(fn [coll]
(= n (reduce + coll))))
(def f (sums-to-n? 10))
(f [1 2 3]) ; false
(f [1 2 3 4]) ; true
@abhijith
abhijith / foo.erl
Created Mar 7, 2014
Pattern matching differences between ocaml and erlang
View foo.erl
-module(foo).
-export([drop/2]).
drop([], Elem) -> [];
drop([Elem|T], Elem) -> drop(T, Elem);
drop([H|T], Elem) -> [H | drop(T, Elem)].
@abhijith
abhijith / test.rb
Created Dec 26, 2012
ironfan cluster definition
View test.rb
Ironfan.cluster 'test0' do
cloud(:ec2) do
availability_zones ['us-east-1d']
ssh_user "ubuntu"
permanent false
flavor 'm1.large'
backing 'ebs'
image_name 'natty'
bootstrap_distro 'ubuntu12.04-ironfan'
View test0.rb
Ironfan.cluster 'test0' do
cloud(:ec2) do
permanent false
availability_zones ['us-east-1d']
flavor 't1.micro'
backing 'ebs'
image_name 'natty'
bootstrap_distro 'ubuntu10.04-ironfan'
chef_client_script 'client.rb'
mount_ephemerals
@abhijith
abhijith / test0.rb
Created Nov 19, 2012
ironfan cluster config
View test0.rb
Ironfan.cluster 'test0' do
cloud(:ec2) do
permanent false
availability_zones ['us-east-1d']
flavor 't1.micro'
backing 'ebs'
image_name 'natty'
bootstrap_distro 'ubuntu10.04-ironfan'
chef_client_script 'client.rb'
mount_ephemerals
@abhijith
abhijith / practice.ml
Last active Oct 4, 2016
OCaml baby steps
View practice.ml
(* random code samples *)
Char.code 'a' (* => 97 *)
Char.uppercase 'a'
Char.chr 33 (* => ! *)
(* STRING CONCATENATION *)
@abhijith
abhijith / check-hbase-status.rb
Created Apr 13, 2012
sensu check-hbase-status plugin
View check-hbase-status.rb
#!/usr/bin/hbase org.jruby.Main
#
# HBase status plugin
# ===
#
# This plugin checks if any of the regionservers are down
#
# Copyright 2012 Runa Inc
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
View poc.clj
(def x (ref 0)
(def agents (for [i (range 0 1000)] (agent x)))
(map #(send %1 (fn [x] (dosync (alter x inc)))) agents)