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
startdate=2015-01-01 | |
enddate=`date "+%Y-%m-%d"` | |
startDateTs=`date -j -f "%Y-%m-%d" $startdate "+%s"` | |
endDateTs=`date -j -f "%Y-%m-%d" $enddate "+%s"` | |
dateTs=$startDateTs | |
offset=86400 | |
while [ "$dateTs" -le "$endDateTs" ] | |
do |
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
### Keybase proof | |
I hereby claim: | |
* I am mikesea on github. | |
* I am mikec (https://keybase.io/mikec) on keybase. | |
* I have a public key whose fingerprint is 2C4A DC67 30AB 3D41 F41F 8182 A735 F17B 829C D927 | |
To claim this, I am signing this object: |
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
$ irb | |
irb(main):001:0> if false | |
irb(main):002:1> foo = "hi" | |
irb(main):003:1> end | |
=> nil | |
irb(main):004:0> foo | |
=> nil | |
irb(main):005:0> bar | |
NameError: undefined local variable or method `bar' for main:Object | |
from (irb):5 |
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
require 'new_relic/agent/instrumentation/controller_instrumentation' | |
DependencyDetection.defer do | |
depends_on do | |
defined?(WeaselDiesel) && defined?(WeaselDiesel::RequestHandler) && | |
WeaselDiesel::RequestHandler.method_defined?(:dispatch) | |
end | |
executes do | |
NewRelic::Agent.logger.debug 'Installing WeaselDiesel instrumentation' |
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
require 'benchmark' | |
array = (1..1000000).map { rand } | |
Benchmark.bmbm do |x| | |
x.report("for:") { for num in array; next; end } | |
x.report("each:") { array.each { |x| next } } | |
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
function getNext() { | |
scan = badgeScans[index]; | |
console.log("got scan " + scan); | |
if (scan) { | |
var scanAction = svgContainer.selectAll("g") | |
.data([scan], function(d){return d.scan_time}); | |
scanAction.exit().remove(); |
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
require 'rest_client' | |
require 'active_support/cache' | |
class MyService | |
def self.find(id) | |
return unless id.present? | |
cache("my-service:#{id}", :ttl => 1.day) do | |
RestClient.get("http://myservice.com/foo/#{id}") | |
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
on :message, /where\s?is (.+)/ do |m| | |
nick = m.params[-1][/where\s?is (.+)/, 1] | |
if nick == @bot.nick | |
m.reply "#{@bot.nick} is both everywhere and nowhere." | |
return | |
end | |
user = @bot.user_list.find(nick) |
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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="robbyrussell" | |
# Aliases |
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
require 'rubygems' | |
require 'cinch' | |
require 'geocoder' | |
bot = Cinch::Bot.new do | |
configure do |c| | |
c.server = "irc.freenode.org" | |
c.channels = ["#super-cool-beans"] | |
c.nick = "_davebot_" | |
end |
NewerOlder