Skip to content

Instantly share code, notes, and snippets.

View Geesu's full-sized avatar

Josh Becker Geesu

View GitHub Profile
@Geesu
Geesu / gist:1a696262e46ba9f0a24c
Created May 7, 2014 01:48
Postgresql replication

Configuration

Slave

  • Install WAL-E (Note: You will have to run sudo python setup.py install MULTIPLE times, probably like 10):
sudo apt-get install daemontools pv lzop
git clone https://github.com/wal-e/wal-e.git && cd wal-e && sudo python setup.py install
  • Configure the environment for WAL-E (as root):
umask u=rwx,g=rx,o=
mkdir -p /etc/wal-e.d/env
echo "THEACCESSKEY" > /etc/wal-e.d/env/AWS_SECRET_ACCESS_KEY
echo "THEKEYID" > /etc/wal-e.d/env/AWS_ACCESS_KEY_ID

#!/bin/bash
echoerr() { echo "$@" 1>&2; }
FAIL=0
echoerr "Called"
`envdir /etc/wal-e.d/env /usr/local/bin/wal-e wal-push $1` & pid_1=$!
Verifying that +geesu is my Bitcoin username. You can send me #bitcoin here: https://onename.io/geesu
class Semaphore
def self.get(name, options = {})
# Create a new Redis connection specifically for the semaphore.
# Treat a semaphore as stale if it's too old. We have to assume that processing was interrupted, so that we can try the same files again.
Redis::Semaphore.new(name.to_sym,
:redis => Aperture.redis,
stale_client_timeout: options[:stale_client_timeout].try(:to_i) || 1.hour,
)
end
end
module Aperture
module Redis
class Pool < ::ConnectionPool
attr_accessor :namespace
def initialize(options = {})
super(options.delete :pool) { ::Redis.new options }
end
def with_namespace(ns)
➜ mono git:(master) ✗ PATH=$PREFIX/bin:$PATH
➜ mono git:(master) ✗ CC='cc -m32' ./autogen.sh --prefix=$PREFIX --disable-nls --build=i386-apple-darwin11.2.0
Running libtoolize...
glibtoolize: putting auxiliary files in `.'.
glibtoolize: copying file `./ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
glibtoolize: copying file `m4/libtool.m4'
glibtoolize: copying file `m4/ltoptions.m4'
glibtoolize: copying file `m4/ltsugar.m4'
glibtoolize: copying file `m4/ltversion.m4'
@Geesu
Geesu / gist:4296f7d4c6c368d6986d
Created December 26, 2014 19:57
make command for mono on OS X Yosemite
➜ mono git:(master) ✗ make
(CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /Volumes/3TB_OSX/Users/Josh/Projects/mono/missing autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
Git submodules updated successfully
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in po
@Geesu
Geesu / gist:d1eae0b336766ddf8711
Created January 6, 2015 17:46
Four wheel NodeBot control
var five = require("johnny-five");
var board = new five.Board();
var stdin = process.stdin;
stdin.setRawMode(true);
stdin.resume();
board.on("ready", function () {
var wheels = {
frontLeft: new five.Servo({ pin: 4, type: 'continuous' }),
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(Rails.configuration.read_db_url)
rescue URI::InvalidURIError
uri = URI.parse(Rails.configuration.master_db_url)
rescue URI::InvalidURIError
raise "Unable to set the read database url"
@Geesu
Geesu / gist:dc9ca283da3fba05c9e4
Created May 11, 2015 18:11
Octopus exception with sidekiq
14:06:04 worker_sunspot.1 | 2015-05-11T18:06:04.008Z 56712 TID-oumuuj9is WARN: /Users/Josh/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `checkout_new_connection'
14:06:04 worker_sunspot.1 | /Users/Josh/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
14:06:04 worker_sunspot.1 | /Users/Josh/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
14:06:04 worker_sunspot.1 | /Users/Josh/.rbenv/versions/2.1.4/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
14:06:04 worker_sunspot.1 | /Users/Josh/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `c