Skip to content

Instantly share code, notes, and snippets.

View thbar's full-sized avatar

Thibaut Barrère thbar

View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@alehmann
alehmann / gist:316522
Created February 27, 2010 06:30
rubyrep / postgres: syncing tables with circular foreign key constraints
psql postgres -c "create database circular_fkeys_left"
psql circular_fkeys_left <<EOS
create table foos(id integer primary key, bar_id integer);
create table bars(id integer primary key, foo_id integer);
insert into foos(id, bar_id) values(1, 5);
insert into bars(id, foo_id) values(5, 1);
alter table foos add constraint bar_fk foreign key(bar_id) references bars;
alter table bars add constraint foo_fk foreign key(foo_id) references foos;
EOS
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@apsoto
apsoto / rvm-your-chef.rb
Created July 7, 2010 23:46 — forked from adamhjk/rvm-your-chef.rb
Chef - Invoke rvm and inherit the environment updates
# Check this out, rvm use rbx
ruby_block "rvm use rbx" do
block do
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e|
o.each_line do |line|
env_bits = line.split("=")
ENV[env_bits[0]] = env_bits[1]
end
end
@karmi
karmi / workers.rake
Created July 22, 2010 15:58
Rake taks to launch multiple Resque workers in development/production with simple management included
# Rake task to launch multiple Resque workers in development/production with simple management included
require 'resque/tasks' # Require Resque tasks
namespace :workers do
# = $ rake workers:start
#
# Launch multiple Resque workers with the Rails environment loaded,
# so they have access to your models, etc.
@matschaffer
matschaffer / mdtopdf.rb
Created September 27, 2010 03:42
A rough translation of markdown to pdf
require 'rubygems'
require 'jekyll'
require 'maruku'
require 'pathname'
# Need pre for inline format support
gem 'prawn', '=0.11.1.pre'
require 'prawn'
require 'to_prawn'
class Converter
@evizitei
evizitei / default_whenever.rb
Created October 29, 2010 19:24
Whenever Chef Recipe on EY AppCloud
#
# Cookbook Name:: whenever
# Recipe:: default
#
ey_cloud_report "whenever" do
message "starting whenever recipe"
end
# Set your application name here
@thbar
thbar / tcp_syslog.rb
Created November 2, 2010 20:46 — forked from gravis/readme
require 'socket'
require 'syslog'
require 'logger'
require 'hoptoad_notifier'
# TcpSyslog is used are a dead-simple replacement for
# syslog ruby libs. None of them is able to send logs
# to a remote server, and even less in TCP.
#
# Example:
@kosmikko
kosmikko / buttons.sass
Created November 5, 2010 19:08
Cross browser button with CSS3 and Sass
@mixin pie
//using CSS3Pie for IE support
behavior: url(/PIE.htc)
.pie
@include pie
@mixin mybutton($bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor, $bordercolor, $textshadowcolor)
//this a mixin for general buttons with gradient background
@include vertical-gradient($bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4)