Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
#
# Reads input given in key=value log format and outputs it as CSV.
# Specify the keys as arguments in the order that they should be
# output. Without arguments, it outputs all values.
#
# E.g.
# cat /tmp/production.log | keyvalue2csv time controller action
# 2014-01-14 13:02:04 +0100,products,index,195.87
# 2014-01-14 13:02:04 +0100,products,index,25.82
@til
til / .bashrc
Last active December 27, 2015 19:19
My favourite radio stations, ready to be played from the command line
alias radio.oe1="mplayer mms://apasf.apa.at/oe1_live_worldwide"
alias radio.fm4="mplayer http://mp3stream1.apasf.apa.at:8000/"
alias radio.wfmu="mplayer http://mp3stream.wfmu.org"
alias radio.o94="mplayer http://orange-01.live.sil.at:8000"
alias radio.88vier="mplayer http://ice.rosebud-media.de:8000/88vier"
alias radio.dradio="mplayer http://dradio-ogg-dlf-l.akacast.akamaistream.net/7/629/135496/v1/gnl.akacast.akamaistream.net/dradio_ogg_dlf_l"
alias radio.funkhauseuropa="mplayer http://fhe-ogg.akacast.akamaistream.net/7/933/199785/v1/gnl.akacast.akamaistream.net/fhe-ogg"
alias radio.fluxfm="mplayer http://fluxfm.hoerradar.de/fluxfm-berlin"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{"type":"MultiLineString","coordinates":[[[13.358133,52.476019],[13.364982,52.47319]],[[13.364982,52.47319],[13.367145,52.474312],[13.369873,52.474765],[13.374165,52.475386],[13.37657,52.476489],[13.37866,52.479516]],[[13.353179,52.479835],[13.352775,52.479808],[13.358133,52.476019]]]}
require 'socket'
require 'minitest/autorun'
describe '0x8c' do
it 'works' do
pid = Process.fork do
C=[];require 'gserver';Class.new(GServer){def serve(i)h=p;C<<i;i.each_line{|l|C.map{|c|c<<(h||=l.strip)+'>'+l}};end}.new($$,'*').start.join #"
#!/usr/bin/env ruby
#
# Calls a running emacs server to visit a file, and optionally move
# point to a line number when included after a colon, e.g. like the
# one from a ruby stacktrace:
#
# emacs-find-file foo/bar.rb:123
abort "Usage: emacs-find-file <file>" unless ARGV[0]
@til
til / gist:2602276
Created May 5, 2012 13:09
Simple script to diagnose network problems of local computer
#!/usr/bin/env ruby
#
# Simple script to diagnose network problems of the local computer:
# runs a couple of checks and aborts on first failure. This should
# help to find the cause of the problem quicker.
def headline(name)
puts
puts "--- #{name} ".ljust(80, '-')
end
#!/bin/sh
spork rspec &
spork cucumber &
tail -n 0 -f log/test.log
wait
Started GET "/refinery" for xxxx at 2011-02-09 17:24:59 +0100
Processing by Admin::DashboardController#index as HTML
Parameters: {"locale"=>:en}
Role Load (0.3ms) SELECT "roles".* FROM "roles" WHERE ("roles"."title" = 'Refinery') LIMIT 1
User Load (0.5ms) SELECT * FROM "users" INNER JOIN "roles_users" ON "users".id = "roles_users".user_id WHERE ("roles_users".role_id = 1 )
Completed in 3ms
Psych::SyntaxError (couldn't parse YAML at line 18 column 33):
$ pgrep -fl 4002
8022 unicorn_rails master -c config/unicorn.rb -E production -p 4002 -D
8024 unicorn_rails master -c config/unicorn.rb -E production -p 4002 -D
26734 unicorn_rails worker[0] -c config/unicorn.rb -E production -p 4002 -D
26736 unicorn_rails worker[0] -c config/unicorn.rb -E production -p 4002 -D
26737 unicorn_rails worker[2] -c config/unicorn.rb -E production -p 4002 -D
26739 unicorn_rails worker[0] -c config/unicorn.rb -E production -p 4002 -D
26740 unicorn_rails worker[2] -c config/unicorn.rb -E production -p 4002 -D
26741 unicorn_rails worker[2] -c config/unicorn.rb -E production -p 4002 -D
26742 unicorn_rails worker[1] -c config/unicorn.rb -E production -p 4002 -D