Skip to content

Instantly share code, notes, and snippets.

View RobinDaugherty's full-sized avatar

Robin Daugherty RobinDaugherty

View GitHub Profile
@RobinDaugherty
RobinDaugherty / zendframework.rb
Created January 3, 2012 19:37
Install ZendFramework Homebrew Formula
require 'formula'
class Zendframework < Formula
url 'http://framework.zend.com/releases/ZendFramework-1.10.3/ZendFramework-1.10.3.tar.gz'
homepage 'http://framework.zend.com'
md5 'da0b497b2446f5612895d689821624e2'
version '1.10.3'
def install
prefix.install Dir['*']
@RobinDaugherty
RobinDaugherty / libsphinxclient.rb
Created December 6, 2012 20:13
Homebrew formula for libsphinxclient
require 'formula'
class Libsphinxclient < Formula
url 'http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz'
homepage 'http://www.sphinxsearch.com'
sha1 'fe1b990052f961a100adba197abe806a3c1b70dc'
head 'http://sphinxsearch.googlecode.com/svn/trunk/'
def install
Dir.chdir "api/libsphinxclient" do
class Picture < ActiveRecord::Base
attr_accessible :picture, :picture_105px_width, :picture_120px_width
has_many :pin
end
@RobinDaugherty
RobinDaugherty / convert-to-utf8.rb
Created August 2, 2013 04:12
Uses https://github.com/brianmario/charlock_holmes to detect encoding of each line of input, converting to UTF-8 for output.
#!env ruby
#
# Converts character encoding of STDIN on a line-by-line basis.
# Properly-encoded UTF-8 is sent to STDOUT.
# Informative messages are sent to STDERR.
#
require 'charlock_holmes'
desired_encoding = 'UTF-8'
@RobinDaugherty
RobinDaugherty / convert-to-utf8.rb
Created August 2, 2013 04:12
Uses https://github.com/brianmario/charlock_holmes to detect encoding of each line of input, converting to UTF-8 for output.
#!env ruby
#
# Converts character encoding of STDIN on a line-by-line basis.
# Properly-encoded UTF-8 is sent to STDOUT.
# Informative messages are sent to STDERR.
#
require 'charlock_holmes'
desired_encoding = 'UTF-8'
@RobinDaugherty
RobinDaugherty / README.md
Last active December 20, 2015 15:09
Load mysqldump into postgres using as many threads as possible.

psql is CPU-bound reading mysqldump output, so it's extremely slow to load records. This script runs as many instances of psql in parallel as possible.

Determines the number of CPUs, which has been tested in Ubuntu.

Assumes data loaded from mysql has timestamps in EST5EDT time zone and has been dumped using the following command line:

mysqldump -f --skip-tz-utc --skip-add-locks --skip-lock-tables --no-create-db --no-create-info --complete-insert --default-character-set=utf8 --max_allowed_packet=1M --net_buffer_length=1M --compatible=postgresql $database $table --result-file=$file;

@RobinDaugherty
RobinDaugherty / tm2-bundles.sh
Last active December 27, 2015 14:49 — forked from tonycoco/tm2-bundles
Textmate 2 bundles for Ruby on Rails development.
mkdir -p ~/'Library/Application Support/Avian/Bundles'
cd ~/'Library/Application Support/Avian/Bundles' && git clone https://github.com/cucumber/cucumber-tmbundle Cucumber.tmbundle
@RobinDaugherty
RobinDaugherty / 1_get-into-screen.sh
Last active January 4, 2016 18:39
Rails app on server
# To connect to the existing screen:
sudo screen -R -x
# - OR -
# If there wasn't already a screen running:
sudo screen -R
# This is a new screen, and you had to use root to start screen,
# so now change to the deploy user, setting up the correct environment.
# Update, upgrade and install development tools:
apt-get update
apt-get -y install build-essential git-core aptitude
aptitude -y remove rbenv
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Set permissions
chgrp users -R /usr/local/rbenv
require 'rubygems'
require 'nokogiri'
require 'gollum'
wiki = Gollum::Wiki.new('auxwiki')
name = 'Ilja Krijger'
email = 'ilja@quittheprogram.org'
f = File.open("AuxiliumWiki-20110705103347.xml")