Skip to content

Instantly share code, notes, and snippets.

View douglasjarquin's full-sized avatar

Douglas Jarquin douglasjarquin

View GitHub Profile
def daemon_monitoring(w, options = {})
# ...
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 30.seconds
c.running = false
c.notify = 'ymorimo'
end
end
# ...
@eklitzke
eklitzke / percona.live.notes.md
Created February 17, 2011 01:04
percona live notes

Percona Server with XtraDB

Introduction

  • 2010 InnoDB 5.1 announced, will first ship with MySQL 5.5.
  • Historically InnoDB development lags while MySQL is trying to GA
  • lots of things fixed in InnoDB since MySQL 5.0
  • important note -- plugin version of InnoDB is not the default in 5.1
@derek-watson
derek-watson / tumblr.rb
Created March 12, 2011 18:47
Tumblr to Jekyll migration
#!/usr/bin/env ruby
# Script to import tumblr posts into local markdown posts ready to be consumed by Jekyll.
# Inspired by New Bamboo's post http://blog.new-bamboo.co.uk/2009/2/20/migrating-from-mephisto-to-jekyll
# Supports post types: regular, quote, link, photo, video and audio
# Saves local copies of images
require 'rubygems'
require 'open-uri'
require 'nokogiri'
@darktable
darktable / app.yaml
Created March 16, 2011 19:10
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@jtimberman
jtimberman / ec2_amis_ubuntu.rb
Created April 23, 2011 06:27
Knife Plugin to list out Ubuntu EC2 AMIs provided by Canonical
require 'chef/knife'
module KnifePlugins
class Ec2AmisUbuntu < Chef::Knife
deps do
begin
require 'ubuntu_ami'
rescue LoadError
Chef::Log.error("Could not load Ubuntu AMI library.")
@polotek
polotek / node_redir_test.js
Created April 25, 2011 03:31
Testing 301 redirects with node
var http = require('http');
var server = http.createServer(function (req, resp) {
if(req.url.match('redir')) {
resp.writeHead(301, {'Location':'http://google.com/', 'Expires': (new Date).toGMTString()});
resp.end();
} else {
resp.writeHead(200, {'content-type': 'text/plain', 'content-length':4});
resp.end('Main');
}
});
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Cloning into rvm...
remote: Counting objects: 4675, done.
remote: Compressing objects: 100% (2353/2353), done.
remote: Total 4675 (delta 3023), reused 3187 (delta 1672)
Receiving objects: 100% (4675/4675), 1.56 MiB | 659 KiB/s, done.
Resolving deltas: 100% (3023/3023), done.
WARNING: Could not source script '/Users/sumeetjain/.rvm/scripts/base', file does not exist. RVM will likely not work as expected.
WARNING: Could not source script '/Users/sumeetjain/.rvm/scripts/version', file does not exist. RVM will likely not work as expected.
WARNING: Could not source script '/Users/sumeetjain/.rvm/scripts/selector', file does not exist. RVM will likely not work as expected.
@bloom
bloom / macjournal_import.rb
Created May 18, 2011 00:27
Import to Day One Journal app from MacJournal Export
require "open3"
def readfile(file)
f = File.open(file)
lines = f.readlines("\n\n\n\n")
lines.each do |line|
fields = line.scan(/\s+Date:\s([^\n]+)$\s+Topic:\s([^\n]+)\n(.*)/m)
date = fields[0][0].strip
@douglasjarquin
douglasjarquin / homebrew-update.sh
Created June 14, 2011 17:58
Update outdated Homebrew packages
brew upgrade `brew outdated | awk {'print $1'} | xargs`
@douglasjarquin
douglasjarquin / rds-migrator.rb
Created July 11, 2011 02:33
Migrate a small database from one RDS instance to another
require 'fileutils'
start_time = Time.now
SOURCE_DATABASE = {
:name => '...',
:user => '...',
:password => '...',
:host => '...'
}