Skip to content

Instantly share code, notes, and snippets.

View andrewberls's full-sized avatar

Andrew Berls andrewberls

View GitHub Profile
(require '[clj-btable.core :as btable])
(def labels ["Login" "View_Cat_Food" "Purchase_Cat_Food"])
(def rows [[5.0 3.0 1.0] [2.0 0.0 0.0] [0.0 0.0 0.0]])
(btable/write "out.btable" labels rows)
; => #<File out.btable>
(btable/labels "out.btable")
; => ["Login" "View_Cat_Food" "Purchase_Cat_Food"]
import Control.Monad
import Data.Maybe
import Text.Printf
import qualified Data.DateTime as DT
data Interval = Interval { start :: DT.DateTime
, end :: DT.DateTime }
deriving (Show)
-- TODO: this shouldn't exist
@andrewberls
andrewberls / pre-push
Created October 22, 2014 19:15
Prevent git pushes directly to master. Install to .git/hooks/pre-push
#!/bin/sh
# Pre-push hook to prevent pushes to master branch.
pushed_branch=`git rev-parse --abbrev-ref HEAD`
if [[ "$pushed_branch" == "master" ]]
then
echo "[Notice] Pre-push hook preventing push to master. Create a feature branch instead."
exit 1
Aug 23 00:46:04 app-3 kernel: [958008.758126] Killed process 3599 (ruby) total-vm:12240780kB, anon-rss:402668kB, file-rss:0kB
Aug 23 00:46:04 app-3 kernel: [958008.761313] in:imklog invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
Aug 23 00:46:04 app-3 kernel: [958008.761316] in:imklog cpuset=/ mems_allowed=0
Aug 23 00:46:04 app-3 kernel: [958008.761319] CPU: 0 PID: 418 Comm: in:imklog Tainted: GF 3.13.0-24-generic #46-Ubuntu
Aug 23 00:46:04 app-3 kernel: [958008.761320] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Aug 23 00:46:04 app-3 kernel: [958008.761321] 0000000000000000 ffff880079eb9980 ffffffff81715a64 ffff88007f90dfc0
Aug 23 00:46:04 app-3 kernel: [958008.761325] ffff880079eb9a08 ffffffff8171039f ffffffff81067876 ffff880079eb99e0
Aug 23 00:46:04 app-3 kernel: [958008.761327] ffffffff810c74dc 0000000000000000 ffff88007fffae28 0000000000000000
Aug 23 00:46:04 app-3 kernel: [958008.761330] Call Trace:
Aug 23 00:46:04 app-3 kernel: [958008.761334] [<ffffffff81715a64>] du
# lib/cache_proxy.rb
class CacheProxy
class << self
attr_accessor :cache
end
def initialize(obj)
@obj = obj
end
// Functional Programming in C++
http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/
class NoSuchElementException < StandardError; end
class Option
def initialize(val)
@val = val
end
def present?
!@val.nil?
end
class Cassandra
alias :old_insert :insert
def insert(column_family, key, hash, options = {})
puts "Injected! Send AMQP notification here..."
old_insert(column_family, key, hash, options)
end
end
module A
def do_something
puts 'A->do_something'
super
end
end
module B
def do_something
puts 'B->do_something'
tracerColors = [
'#1B184F',
'#312c91',
'#423ac0',
'#9c4274'
]
class Tracer extends Kona.Entity