Skip to content

Instantly share code, notes, and snippets.

@potomak
potomak / airbrake_fetcher.rb
Last active June 12, 2016 17:21
Collect and show Airbrake errors metrics with Ruby
require 'json'
require 'open-uri'
class AirbrakeFetcher
BASE_URL = 'https://airbrake.io'
DEFAULT_LIMIT = 100
def initialize(api_key, project_id)
@api_key = api_key
@project_id = project_id
@potomak
potomak / README.md
Last active March 20, 2016 15:38
Profiling a Haskell executable memory usage

Profiling a Haskell executable memory usage

To generate a heap profile from your program:

  1. Compile the program for profiling.
  2. Run it with one of the heap profiling options (eg. -h for a basic producer profile). This generates the file prog.hp.
  3. Run hp2ps to produce a Postscript file, prog.ps.

Notes about the compilation for profiling

(function() {
// Notes from http://news.ycombinator.com/item?id=1952531
var notes = {
"suspended cymbal":"zk",
"snare":"bschk",
"brush":"pv",
"bass":"bk",
"flam1":"tk",
"roll tap":"vk",
"flam2":"kt",
@potomak
potomak / gist:7941218
Created December 13, 2013 08:13
Suggested Ruby On Rails Learning Resources
@potomak
potomak / notify_url_change.rb
Created October 11, 2013 12:12
Get a notification when the NodeKO registration opens.
require 'eventmachine'
require 'em-http-request'
EM.run {
timer = EM::PeriodicTimer.new(60) do
http = EM::HttpRequest.new('http://nodeknockout.com/teams/new').get
http.errback {
puts 'Uh oh'
}
gem 'rails-api'
gem 'active_model_serializers'
gem_group :development, :test do
gem 'debugger'
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'factory_girl_rails'
end
@potomak
potomak / jitsu_users_confirm.out
Created July 10, 2012 21:09
Nodejitsu account confirmation
giovanni@thinkpad:~$ jitsu users confirm potomak XXX
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command users confirm potomak XXX
info: Confirming user potomak
info: Great success! potomak is now confirmed.
info: User potomak confirmed
info: Would you like to log in now?
prompt: (yes/no): (yes)
info: Attempting to log in as potomak
@potomak
potomak / voices.sh
Created November 29, 2011 14:14
Listen to all the voices of your PC
#!/bin/sh
for i in $(ls -r -t /System/Library/Speech/Voices/ | awk -F'.' '{print $1}'); do
echo $i
say -v $i "Hi, I'm $i"
done
@potomak
potomak / terminal_ansicolors.rb
Created October 24, 2011 08:23
Testing terminal colors
require 'rubygems'
require 'term/ansicolor'
COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
class String
include Term::ANSIColor
end
(0..15).each do |x|