Gourmet Service objects
@pcreux
Feb 27, 2014
http://vanruby.org
#!/usr/bin/env ruby | |
# Copy a heroku app (buildpacks, add-ons, labs, config, users). | |
# This script is idempotent so it can run against an existing app. | |
# | |
# Usage: | |
# $> clone-heroku-app source-app target-app | |
require 'json' |
# You can't use rebase -i here since it takes the parent commit as argument. | |
# You can do the following though: | |
git checkout FIRST_COMMIT_SHA && git commit --amend && git rebase HEAD master |
#!/usr/bin/env ruby | |
# Generate a dbdiagram for dbdiagram.io from a dbt project. | |
# | |
# Usage: | |
# 1. Run `dbt docs generate` first. | |
# 2. Run `dbt_to_dbdiagram.rb` | |
# 3. Paste the output in https://dbdiagram.io/ | |
require 'yaml' | |
require 'json' |
@pcreux
Feb 27, 2014
http://vanruby.org
# ruby convert-to-ipad.rb video1.avi video2.avi video3.avi | |
# | |
# Prereq: brew install ffmpeg | |
ARGV.each do |input_file| | |
output_file = input_file.gsub('.avi', '.ipad.mp4') | |
cmd = "ffmpeg -i #{input_file} -acodec aac -ac 2 -strict experimental -ab 160k -s 1024x768 -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 #{output_file}" | |
puts cmd | |
system cmd | |
end |
#/bin/bash | |
# From http://wiki.opscode.com/display/chef/Package+Installation+on+Debian+and+Ubuntu | |
# Run: wget http://gist.github.com/raw/568876/install_chef_client.sh && bash install_chef_client.sh | |
echo "Add the Opscode APT Repository" | |
echo 'deb http://apt.opscode.com/ lucid main' | sudo tee /etc/apt/sources.list.d/opscode.list | |
sudo apt-get update | |
echo "Install curl" | |
sudo apt-get install curl |
#!/usr/bin/env ruby | |
# Usage: ruby dbt-log-to-csv.rb PATH_TO_DBT_LOGS | |
Model = Struct.new(:schema, :table, :rows_str, :size_str, :duration_str) do | |
def rows | |
rows = rows_str.to_f | |
rows = case rows_str | |
when /\d$/ | |
rows |
# Postgresql fancy datatypes! | |
* array | |
* hstore (=~ hash) | |
* json | |
* jsonb | |
Philippe Creux - [@pcreux](http://twitter.com/pcreux) |
#!/usr/bin/env ruby | |
# Jabber-SH — SH console via XMPP/Jabber (GTalk) | |
# | |
# Jabber-SH allows you to administrate a remote computer via a command line | |
# through a Jabber client. It’s like SSH via GoogleTalk! :) | |
# This is just a hack but it might be usefull sometime to run basic commands | |
# on a machine that is not accessible via ssh. | |
# | |
# Philippe Creux. pcreux/AT/gmail/DOT/com |
group :production do | |
gem 'unicorn' | |
# Enable gzip compression on heroku, but don't compress images. | |
gem 'heroku-deflater' | |
# Heroku injects it if it's not in there already | |
gem 'rails_12factor' | |
end |