Skip to content

Instantly share code, notes, and snippets.

View mstump's full-sized avatar
😀

Matt Stump mstump

😀
  • San Francisco, CA
View GitHub Profile
(ns courier.test.storm.ruby
(:use [backtype.storm clojure]
[backtype.storm bootstrap testing]
clojure.test
midje.sweet)
(:require [courier.db :as db]
[courier.util :as util]
[courier.lib.ruby.core :as ruby]
[courier.storm.ruby :as sruby]
[courier.models.package :as pkg]
@mstump
mstump / gist:2472982
Created April 23, 2012 18:42
properties, why you exceed stack size?!?
(defn load-npm-callback
[err npm]
(.ls (. npm -commands) [] true print-deps))
@mstump
mstump / topo_and_bolt.clj
Created April 20, 2012 06:51
data leaves spout, but doesn't arrive at bolt
(defbolt build-package-hash-bolt ["package"]
[tuple collector]
(emit-bolt! collector [(build-package-hash (:message tuple))] :anchor tuple)
(ack! collector tuple))
(defbolt json-deser-bolt ["message"]
[tuple collector]
(try
(emit-bolt! collector [(json/parse-string (:message tuple))] :anchor tuple)
(ack! collector tuple)
;; this one outputs to stdout until it dies due to 'Exceeded max jobconf'
(defn format-package-repo-for-cassandra
[source-type base-attributes sink repo]
(cio/with-fs-tmp [_ tmp]
(let [packages (package-seq repo)]
(if-not (empty? packages)
(let [lazy-tap (ops/lazy-generator tmp packages)]
(?<- (stdout)
[?row-key ?col ?val]
@mstump
mstump / broken.clj
Created February 3, 2012 23:32
Unexpected third parameter from Cascalog aggregator
(ns test.core
(:use cascalog.api)
(:require [cascalog [vars :as v]])
(:gen-class))
(def sample_data
[{:path nil, :javadoc? :not_present, :bundle_docurl nil, :bundle_symname nil, :bundle_name nil, :bundle_exportsrv nil, :prefix nil, :lastmodified 1127001651000, :bundle_importpkg nil, :groupid "xfire", :bundle_description nil, :version "1.0-20050917.231235", :size 21774, :packaging "jar", :remoteurl nil, :classnames nil, :signature? :not_present, :bundle_license nil, :source? :not_present, :sha1 "eed564da25682c728f7ad3da557656f0766376de", :repository nil, :bundle_exportpkg nil, :bundle_version nil, :fname nil, :description nil, :artifiactid "xfire-plexus", :md5 nil, :fextension "jar"}
{:path nil, :javadoc? :not_present, :bundle_docurl nil, :bundle_symname nil, :bundle_name nil, :bundle_exportsrv nil, :prefix nil, :lastmodified 1162775407000, :bundle_importpkg nil, :groupid "xfire", :bundle_description nil, :version "1.0-20050917.231219", :size -1, :packaging nil, :remoteurl nil, :classnames nil, :s
(defn __findIntegerTriaglesWithIntRatio [p a bseq output]
(if (empty? bseq)
output
((def a (findArea p a (first bseq)))
(if (integerRatio? a p)
(recur p a (rest bseq) (conj output a))
(recur p a (rest bseq) output)))))
#!/usr/bin/ruby
#
# I deliberately didn't DRY /usr/local references into a variable as this
# script will not "just work" if you change the destination directory. However
# please feel free to fork it and make that possible.
#
# If you do fork, please ensure you add a comment here that explains what the
# changes are intended to do and how well you tested them.
#
# 30th March 2010: