Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
Bundler.require :default
URL = ''
METRICS_USER = ''
METRICS_TOKEN = ''
def measure_request(url)
t0 = Time.now
#!/usr/bin/env ruby
require 'cgi'
require 'uri'
require 'net/http'
require 'net/https'
USER = ARGV[0]
TOKEN = ARGV[1]
REGEX = ENV['REGEX'] ? Regexp.new(ENV['REGEX']) : /^(\S+)\s+(\S+)$/
Name : librato-silverline
Version : 3.1.3
Release : 1
Architecture: i386
Install Date: Fri 05 Aug 2011 10:50:07 AM PDT
Group : Development/Tools
Size : 791689
License : Librato, Inc.
Signature : RSA/SHA256, Fri 05 Aug 2011 08:47:22 AM PDT, Key ID 4bdb4cd3e9891ef5
Source RPM : librato-silverline-3.1.3-1.src.rpm

Notifo notifier

Send yourself a notification with:

$ notifo --user myself --token c01e66f7c7ebb828cd8f59282a3c6c18 'The job is done'

Don't worry about remembering your token:

$ echo "NOTIFO_USER=myself" >> ~/.notifo_credentials

$ echo "NOTIFO_TOKEN=c01e66f7c7ebb828cd8f59282a3c6c18" >> ~/.notifo_credentials

irb(main):036:0> Encoding.default_external
=> #<Encoding:UTF-8>
irb(main):037:0> data
=> "one two three 32\xC2\xB0\n\xEE\x80\x8E\xEE\x80\x97\xEE\x91\x81\xEE\x81\x94\n\xFF"
irb(main):038:0> data.encoding
=> #<Encoding:ASCII-8BIT>
irb(main):039:0> data.valid_encoding?
=> true
irb(main):040:0> encoded_data = data.encode('utf-8', :invalid => :replace, :undef => :replace)
=> "one two three 32��\n������������\n�"
$ sudo gem install memcached -v 1.3.4
Fetching: memcached-1.3.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing memcached:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
Touching aclocal.m4 in libmemcached.
touch -r libmemcached-0.32/m4/visibility.m4 libmemcached-0.32/configure.ac libmemcached-0.32/m4/pandora_have_sasl.m4
Configuring libmemcached.
$ sudo gem install memcached -v 1.3.4
Building native extensions. This could take a while...
ERROR: Error installing memcached:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
Touching aclocal.m4 in libmemcached.
touch -r libmemcached-0.32/m4/visibility.m4 libmemcached-0.32/configure.ac libmemcached-0.32/m4/pandora_have_sasl.m4
Configuring libmemcached.
env CFLAGS='-fPIC -g -O2 -g -O2 ' LDFLAGS='-fPIC -L. -rdynamic -Wl,-export-dynamic -L. -rdynamic -Wl,-export-dynamic -L/usr/lib' ./configure --prefix=/usr/lib/ruby/gems/1.8/gems/memcached-1.3.4/ext --without-memcached --disable-shared --disable-utils --disable-dependency-tracking CC="gcc" 2>&1
#!/usr/bin/perl -w
#
# take a 1 second average of bandwidth
# eric lindvall <[email protected]>
#
use strict;
$| = 1;
::Kestrel::Client.class_eval do
add_method_tracer :get, 'Kestrel/get'
add_method_tracer :set, 'Kestrel/set'
end
@eric
eric / linux_proc_name.rb
Created November 9, 2011 07:39
Update a process name in linux to change how it shows up in top and lsof
#
# Eric Lindvall <[email protected]>
#
# Update the process name for the process you're running in.
#
# This will allow top, lsof, and killall to see the process as the
# name you specify.
#
# Just use:
#