Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'socket'
LISTEN_PORT = 8514
DESTINATION_HOST = "xxxx.papertrailapp.com"
DESTINATION_PORT = xxxx
class SyslogRelay
PARSER = /^(<\d+>\S+\s+\S+\s+\S+) \("([^,]+),([^,]+),([^"]+)"\) ([^:]+): (.*)$/
@eric
eric / DISCLAIMER.md
Created March 28, 2011 22:59
Log directly to Papertrail or any remote syslog target from Heroku
@eric
eric / linux-meminfo.rb
Created April 8, 2010 02:19
Gather more useful memory statistics for SNMP
#!/usr/bin/env ruby
#
# linux-meminfo
#
# by Eric Lindvall <eric@5stops.com>
#
# Gather more useful memory statistics for SNMP
#
# To see the example output, run:
# linux-meminfo.rb -g .1.3.6.1.4.1.2021.4.6.0
/*
* Bookmarklet for viewing source in iPad Safari
* Originally from http://www.ravelrumba.com/blog/ipad-view-source-bookmarklet/
*/
javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=720, maximum-scale=1.0, minimum-scale=1.0, initial-scale=1.0" /></head><body></body></html>');
obs = obslua
os = require("os")
io = require("io")
relative_path_from_home = "Dropbox/Twitch Assets"
settings_path = ""
function refresh_button_clicked(props, p)
update()
end
@eric
eric / _deploy.rb
Created May 29, 2012 06:00
Capistrano notification for Boundary
# load plugin
load 'boundary'
# Notify boundary with your orgid, apikey
boundary.register 'cdd7261592bca18539eae9bb5f1bcfdd', 'f9e6282c4727c5733585a4be86e0f990'
@eric
eric / README.md
Created March 18, 2011 20:20
A simple mechanism to log metrics to Redis

Redis Timeseries Metric

I've been playing around with trying to make it as simple as possible to start logging a few metrics with as little effort in setup as possible.

As I was working on Papertrail I came up with a couple interesting ideas, some of which were inspired by OpenTSDB.

Storing metrics

In this example we are pretending we're processing emails as background jobs and would like to track how many we've sent over time.

@eric
eric / require_tracking.rb
Created December 28, 2009 02:18
A simple tool to gather memory usage when files are required. More info at: http://bitmonkey.net/post/308322913
#
# Created by Eric Lindvall <eric@sevenscale.com>
#
# WHAT: Provides a simple overview of memory allocation occuring during a
# require.
#
# For a longer explanation, see my post at:
#
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby
#
@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 <eric@5stops.com>
#
# 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:
#
@eric
eric / copy_librato_dashboard.rb
Last active July 15, 2016 22:11 — forked from jderrett/copy_librato_dashboard.rb
Copy Librato Dashboard from one account to another
require 'faraday'
require 'faraday_middleware'
require 'json'
class DashboardApi
LIBRATO_API = 'https://metrics-api.librato.com'
LIBRATO_API_VERSION = 'v1'
ENDPOINT = [LIBRATO_API, LIBRATO_API_VERSION].join('/')
attr_accessor :username