Skip to content

Instantly share code, notes, and snippets.

View ossareh's full-sized avatar

P. Michael Ossareh ossareh

View GitHub Profile
@ossareh
ossareh / fetch_asgard.py
Last active August 29, 2015 13:57
Simple script to fetch latest asgard build
#!/usr/bin/env python2
# The MIT License (MIT)
#
# Copyright (c) 2014 Michael Ossareh & Twitch Interactive, Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
@ossareh
ossareh / commands on the shell
Created October 16, 2014 20:33
steps to clean up excessive launch configs
$ sudo apt-get install awscli
$ aws configure
$ aws autoscaling describe-launch-configurations | grep LaunchConfigurationName | cut -d '"' -f4 > all_lcs
$ aws autoscaling describe-auto-scaling-groups | grep LaunchConfigurationName | cut -d '"' -f4 | sort -u > used_lcs
$ ./delete.py > delete_lcs
$ for i in `cat delete_lcs`; do aws autoscaling delete-launch-configuration --launch-configuration-name ${i}; done
@ossareh
ossareh / gist:713338
Created November 24, 2010 08:37
lazytest Exception
ossarehs-macbook:rah parhamossareh$ java -cp "src:test:classes:lib/*:lib/dev/*" lazytest.main src test
Exception in thread "main" java.lang.AssertionError: Assert failed: (not (depends? graph dep x))
at lazytest.dependency$depend.invoke(dependency.clj:41)
at clojure.lang.AFn.applyToHelper(AFn.java:169)
at clojure.lang.RestFn.applyTo(RestFn.java:133)
at clojure.core$apply.invoke(core.clj:544)
at lazytest.tracker$add_to_dep_graph$fn__86.invoke(tracker.clj:24)
at clojure.core$r.invoke(core.clj:799)
at lazytest.tracker$add_to_dep_graph.invoke(tracker.clj:21)
at lazytest.tracker$update_dependency_graph.invoke(tracker.clj:32)
@ossareh
ossareh / underscore_ex.html
Created December 2, 2010 19:46
underscore
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script>
var obj = {"NUM_T1":"581","CABS":{"NYKFP02-CABW1":{"VOLTAGE":54.51,"CURRENT":18.27},"NYKFP02-CABW2":{"VOLTAGE":54.65,"CURRENT":16.85}}}
_.each(obj.CABS, function(v, k) {
console.log("cab '" + k + "' has voltage: " + v.VOLTAGE) ;
}) ;
</script>
(defn pos-int-range [max]
;; rest drops leading 0
;; inc as range is not inclusive
(lazy-seq (rest (range (inc max)))))
(defn not-nil? [x] (not= nil x))
(defn hiphop [n]
(cond (> n 2)
(cond (and (zero? (mod n 15))) "Hop"
(ns company-count
(:use [clojure.contrib.http.agent :only (http-agent stream)])
(:use [clojure.contrib.json])
(:use [clojure.contrib.io :only (read-lines)]))
(defonce companies (read-json (slurp "http://api.crunchbase.com/v/1/companies.js")))
(def emp-ranges (agent {}))
@ossareh
ossareh / company_count.clj
Created December 12, 2010 21:35
without the issues
(ns company-count
(:require [work.core :as work])
(:use [clojure.contrib.json])
(:use [clojure.contrib.io :only (read-lines)]))
(defonce companies (read-json (slurp "http://api.crunchbase.com/v/1/companies.js")))
(def emp-ranges (agent {}))
@ossareh
ossareh / boilerplate.clj
Created January 3, 2011 01:41
boilerplate with a ring middleware
(ns surveyengine.boilerplate
(:use [hiccup.core])
(:use [hiccup.page-helpers]))
(defn boilerplate
([] (boilerplate {} [] [] [] [] {:prod? false}))
([{:keys [title desc author favicon apple-icon cssver] :as head}
header
main
footer
@ossareh
ossareh / riak crash
Created January 5, 2011 20:57
riak crash when parsing Ratio's encoded by c.c.json
==> log/sasl-error.log <==
=CRASH REPORT==== 4-Jan-2011::21:03:53 ===
crasher:
initial call: luke_phase:init/1
pid: <0.5305.13>
registered_name: []
exception exit: {error,[{<<"lineno">>,483},
{<<"message">>,<<"JSON.parse">>},
{<<"source">>,<<"unknown">>}]}