Skip to content

Instantly share code, notes, and snippets.

View oriolgual's full-sized avatar

Oriol Gual oriolgual

View GitHub Profile
{
"_links": {
"self": { "href": "..." },
"productions": { "href": "..." }
}
}
@henrik
henrik / ocr.markdown
Created March 3, 2012 17:07
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.

@diasjorge
diasjorge / Agenda
Created February 15, 2012 18:48
Efficient bash cheat sheet
Efficient moving
Ctrl-a Move to the start of the line.
Ctrl-e Move to the end of the line.
Ctrl-b Move back one character.
Alt-b Move back one word.
Ctrl-f Move forward one character.
Alt-f Move forward one word.
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@yalab
yalab / heroku_mongo_backup
Created November 17, 2011 10:24
Backup scripts MongoHQ databases using heroku.
#!/bin/bash
HEROKU="/home/yalab/.rvm/gems/ruby-1.9.3-p0/bin/heroku"
BACKUP_DIR="$HOME/.backup/mongohq"
if [ ! -d $BACKUP_DIR ];then
mkdir -p $BACKUP_DIR
fi
for APP in `$HEROKU list`;do
MONGOHQ_URL=`heroku config --app $APP | grep MONGOHQ_URL | awk '{print $3}'`
@bkimble
bkimble / gist:1365005
Last active August 22, 2024 14:21
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@denmarkin
denmarkin / resque.rake
Created September 20, 2011 11:02
My rake task for clearing Resque queues and stats
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version
# see https://github.com/defunkt/resque/issues/49
# see http://redis.io/commands - new commands
namespace :resque do
desc "Clear pending tasks"
task :clear => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
@josepjaume
josepjaume / gist:1206106
Created September 9, 2011 12:40
Time comparison inconsistency with SQLite, PostgreSQL and MySQL with ActiveRecord
def pending_notifications
notifications = self.notifications
if last_notification_read_at
# Sqlite doesn't properly compare dates because doesn't have a dedicated
# type for it.
# TODO: Investigate further and find a better solution for this.
#
time_restriction = if connection.class.name.demodulize =~ /SQLite/
@oriolgual
oriolgual / pdf_to_text.rb
Created September 7, 2011 10:56
Assert the contents of a generated PDF with Capybara and Cucumber
# Dependencies: pdftotext (included in xpdf)
# OSX: brew install xpdf
# Ubuntu/Debian: apt-get install xpdf
Then /^I should have get a pdf with the business name$/ do
page.response_headers['Content-Type'].should include 'application/pdf'
pdf_to_text.should include @current_business.name
end
def pdf_to_text
@bcardarella
bcardarella / gist:1161159
Created August 21, 2011 20:59 — forked from jasonm/gist:1161101
Links from #rcne 2011 backbone.js on rails fireside chat