Skip to content

Instantly share code, notes, and snippets.

View danslimmon's full-sized avatar

Dan Slimmon danslimmon

View GitHub Profile
@danslimmon
danslimmon / bob_log_grammar.rb
Created July 8, 2011 13:10
Factory/Dictionary solution to log grammar
class LogFormatElement
@_caster = nil
attr_accessor :abbrev, :name, :regex
# Class variables that determine the _default_ for abbrev, name, and regex in an instance.
# That is, an instance will initialize with these values for the instance variables @abbrev,
# @name, and @regex.
class << self; attr_accessor :abbrev, :name, :regex end
# Additionally we need to access this from within the instance:
class << self; attr_accessor :_caster end
@danslimmon
danslimmon / deprec_hook.rb
Created September 4, 2011 18:22
Deprecation git hook
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
# This is a git update hook that allows you to declare a given class
# or method or what-have-you deprecated. If you try to push deprecated
# code to the repo, you'll see an error and the push will fail. The
# error also gives you a string that you can stick in your commit
# message to bypass the deprecation rule.
@danslimmon
danslimmon / gist:1510628
Created December 22, 2011 15:11
chef runtimes => logstash
grok patterns:
CHEF_RUNTIME INFO: Chef Run complete in %{NUMBER:runtime} seconds
HOST_PART \b[A-Za-z][0-9A-Za-z-]{0,62}\b
HOST_FIRSTPART %{HOST_PART:hostname_short}
collector.conf:
filter {
dan@george:~$ echo union > foo.csv
dan@george:~$ file foo.csv
foo.csv: ASCII c program text
dan@george:~$ echo onion > foo.csv
dan@george:~$ file foo.csv
foo.csv: ASCII text
dan@george:~$ echo function > foo.csv
dan@george:~$ file foo.csv
foo.csv: ASCII text
dan@george:~$ echo typedef > foo.csv
$ echo "uvoptcuce faimspz ara"|sed 'secede; severe; syzygy; samsara; serenade; seduceable; serpentine; strategist'
unadoptable fainting aegis
@danslimmon
danslimmon / gist:3822522
Created October 2, 2012 19:02
add_timestamps.pl
#!/usr/bin/perl
#
# What it does (example):
#
# dan@cleon:~/tools/server$ yes | ./add_timestamps.pl | head
# 2012-10-02 14:59:16.579109 y
# 2012-10-02 14:59:16.579180 y
# 2012-10-02 14:59:16.579210 y
# 2012-10-02 14:59:16.579240 y
# 2012-10-02 14:59:16.579269 y
'Twas C.O.B., and the parchsome blusts
Did crask and clottle in the scrit;
All blooping were the plixenplusts
And the roop lam'd a-flit.
"Beware the Jabberluck, my dev!
The beers that swirl, the fries that crunch!
Beware the bumble shot, and dread
The glugulous berclunch!"
1. Please say yes! I don't think I ________ no!
2. You should only sign his birthday ________ you know him personally.
3. I think people should wear more colorful clothing to work. I'm against the ________ of officewear.
4. Roker really can't stand Ke$ha. Every time she performs, ________.
5. Let's play a game where you can step anywhere except on top of that spoiled child: the ________.
6. That boxer is going to get K.O.'ed unless somebody rings that ________.
7. Dude, grab this joint and ________!
8. Man, you're really dragging ass spinning those letters around today, ________?
9. All my livestock eat grass, except that one heifer nibbling at a tree trunk. She's more of a ________.
10. I made a list of fantasy settings. Middle Earth and Hogwarts are among my favorites, but I had to rank ________.
@danslimmon
danslimmon / gist:4278347
Created December 13, 2012 18:02
Jeopardy answers by the expectation value, in dollars, per show, of knowing them inside-out.
44.1083 australia
41.0997 india
39.1997 france
39.0144 chicago
37.5076 spain
36.5160 canada
35.1466 japan
35.1279 brazil
34.5065 south africa
34.0746 italy
@danslimmon
danslimmon / gist:4278418
Created December 13, 2012 18:15
Top 1000 Jeopardy answers by number of appearances
australia
china
chicago
france
japan
india
california
canada
spain
mexico