Skip to content

Instantly share code, notes, and snippets.

View gjcourt's full-sized avatar

George Courtsunis gjcourt

View GitHub Profile
@print: ->
console.log '[DEBUG]', arguments... if DEBUG
return
This file has been truncated, but you can view the full file.
A
a
aa
aal
aalii
aam
Aani
aardvark
aardwolf
Aaron
#!/bin/sh
echo "Lines of code" $(
find enki -name \*.html -o -name \*.css -o -name \*.js -o -name \*.coffee -o -name \*.py \
| grep -vE "/migrations/" \
| grep -vE "enki/static/admin" \
| grep -vE "enki/static/CACHE" \
| grep -vE "enki/static/css/lib" \
| grep -vE "enki/static/css/mobile" \
| grep -vE "enki/static/js/lib" \
@gjcourt
gjcourt / -
Created February 7, 2014 21:56
diff --git a/storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj b/storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj
index 28b9202..9e10fab 100644
--- a/storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj
+++ b/storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj
@@ -22,15 +22,16 @@
:implements [backtype.storm.scheduler.IScheduler]))
(defn sort-slots [all-slots]
- (let [split-up (vals (group-by first all-slots))]
- (apply interleave-all split-up)
include_recipe "python"
include_recipe "sudo"
package "htop"
package "tree"
package "libcurl3"
package "fail2ban"
package "unattended-upgrades"
package "logwatch"
@gjcourt
gjcourt / partition.py
Last active December 24, 2015 23:19
Partition a collection into bins of size K
def partiton(collection, size):
return zip(*[iter(collection)]*size)
@gjcourt
gjcourt / subset_sum.py
Created August 23, 2013 03:38
For a given sequence finds all solutions to the subset sum problem.
lst = [2, 2, 3, -5]
from itertools import *
[m[1] for m in zip(chain(*[combinations(lst, n) for n in range(1,len(lst)+1)]), chain(*[combinations(range(len(lst)), n) for n in range(1,len(lst)+1)])) if sum(m[0]) == 0]
@gjcourt
gjcourt / cass-graphite.py
Last active December 20, 2015 12:39
Changes made to graphite-web to put it on top of Cassandra instead of Graphite. This is version 0.9.10 of graphite-web
diff --git a/requirements.txt b/requirements.txt
index 4adaf3c..3395e1b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -40,3 +40,4 @@ pytz
http://cairographics.org/releases/py2cairo-1.8.10.tar.gz
git+git://github.com/graphite-project/whisper.git#egg=whisper
raven==3.2.1
+ds==0.8.10
/**
* Parse the query string portion of a string containing a URI or URL.
*/
def parseUri(uri: String): Map[String, Seq[String]] = {
var params = collection.mutable.HashMap[String, Seq[String]]()
val parts = uri split "\\?"
if (parts.length > 1) {
val query = parts(1)
for (param <- query split "&") {
val pair = param split "="
@gjcourt
gjcourt / diff_dict.py
Created April 8, 2013 23:42
Find all differing keys in two dictionaries
def diff_dict(d1, d2):
"""
Determine which keys have changed between two dictionaries
"""
def diff(d1, d2, r):
for k in d1:
if k not in d2:
r[k] = d1[k]
elif d1[k] != d2[k]:
if issubclass(d2[k].__class__, dict):