This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def status-params | |
{:count 200}) | |
(defn tweets | |
"Get the user's tweets | |
params contains params to override the defaults, such as :since_id" | |
[params] | |
(:body (statuses-home-timeline :oauth-creds my-creds | |
:params (merge status-params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'RMagick' | |
def generate_image(name, size) | |
puts "#{name}: generate #{size}x#{size} image" | |
Magick::Image::read('logo.png').first.resize(size, size).write(name) | |
end | |
[144, 120, 114, 100, 72, 60, 58, 57, 50, 29].each do |size| | |
generate_image("icon-#{size}x#{size}.png", size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(streams | |
(where (and metric (service "app1")(tagged "sign_in") | |
; We want to get alerted about failed sign ins. However we expect that there will be failures | |
; due to incorect passwords etc. So we only want to get alerted if more than 50% of the signins | |
; in a 60 second period are failures. The app tags failed signins with a warning state. | |
(fixed-time-window 60 | |
(smap (fn [events] | |
; count all warnings and count all received events and work out the percentage | |
(let [percent (/ (count (filter #(= (:state %) "warning") events)) | |
(count events))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'pickup' | |
gem 'riemann-client' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Util | |
module StatsHelper | |
def gauge(key, value) | |
key = full_key(key) | |
puts "key: #{key}, value: #{value}" | |
$statsd.gauge(key, value) | |
$riemann_client << {service: key, metric: value} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Last commit: 8801f2e (2013-02-15 13:53:27 -0800) | |
(function() { | |
window.DS = Ember.Namespace.create({ | |
// this one goes to 11 | |
CURRENT_API_REVISION: 11 | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Rails Upgrade check | |
# | |
# Check your github repos for out of date rails apps | |
# | |
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ruby railscheck.rb | |
# or | |
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ORG=yourorgname ruby railscheck.rb | |
# | |
# n.b requires the octokit gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do_something([ | |
{ | |
"metadata"=> { | |
"url"=>"http://www.nature.com/nature/journal/v489/n7415/full/nature11421.html", | |
"metadata_attributes"=> [{ | |
"attr"=>"doi", | |
"value"=>"10.1038/nature11421" | |
}] | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2013-01-29 14:20:47 supervisor [ERROR] Error on initialization of server mk-supervisor | |
java.lang.RuntimeException: java.io.EOFException | |
at backtype.storm.utils.Utils.deserialize(Utils.java:59) | |
at backtype.storm.utils.LocalState.snapshot(LocalState.java:24) | |
at backtype.storm.utils.LocalState.get(LocalState.java:28) | |
at backtype.storm.daemon.supervisor$standalone_supervisor$reify__4786.prepare(supervisor.clj:476) | |
at backtype.storm.daemon.supervisor$fn__4733$exec_fn__1207__auto____4734.invoke(supervisor.clj:322) | |
at clojure.lang.AFn.applyToHelper(AFn.java:167) | |
at clojure.lang.AFn.applyTo(AFn.java:151) | |
at clojure.core$apply.invoke(core.clj:601) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def people [{:name "Will" | |
:health 1} | |
{:name "Not Will" | |
:health -10}]) | |
(get-in people [0 :name]) #=> "Will" |