Skip to content

Instantly share code, notes, and snippets.

View thbar's full-sized avatar

Thibaut Barrère thbar

View GitHub Profile
@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:
# 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
@thbar
thbar / tomcat6
Created February 12, 2011 21:37 — forked from tcocca/tomcat6
#!/bin/sh -e
# chkconfig: 345 99 1
# description: Tomcat6 service
# processname: java
# Get LSB functions
. /lib/lsb/init-functions
export JAVA_HOME=/usr
export TOMCAT_USER=solr
require 'growl'
require 'open3'
ENV["WATCHR"] = "1"
$spec_cmd = "env RSPEC_COLOR=true spec --drb --colour --format nested"
$cuke_cmd = "cucumber --color --drb --require features/step_definitions --require features/support"
$pass = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pass.png')
$fail = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'fail.png')
$pending = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pending.png')
@thbar
thbar / elasticoverflow.rb
Created May 4, 2011 07:39 — forked from karmi/elasticoverflow.rb
Importing and searching RSS with ElasticSearch and Tire
# =======================================================
# Importing and searching RSS with ElasticSearch and Tire
# =======================================================
#
# This script downloads, parses and indexes Stackoverflow RSS feed with ElasticSearch
# via the [Tire](https://github.com/karmi/tire) Rubygem.
#
# Requirements
# ------------
#
@thbar
thbar / gist:1209593
Created September 11, 2011 13:38 — forked from assaf/gist:1207141
rescueFrom for jQuery AJAX requests
rescue_from = {}
# Associate status code with an HTTP status code. First argument is the status
# code, second argument is a function that accepts the XHR object. For example:
# $.rescueFrom 404, (xhr)-> alert("Oh no, page not found!")
$.rescueFrom = (status, fn)->
rescue_from[status] = fn
# Default handling for unsuccessulf HTTP status code. Finds and calls most
# appropriate handler based on the HTTP status code (see `$.rescueFrom`).
@thbar
thbar / _gradients.css.scss
Created October 27, 2011 11:28 — forked from mihar/_gradients.sass
SCSS mixing for CSS3 gradients
@mixin gradient($from, $to) {
/* fallback/image non-cover color */
background-color: $from;
/* Firefox 3.6+ */
background-image: -moz-linear-gradient($from, $to);
/* Safari 4+, Chrome 1+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
@thbar
thbar / nokogiri
Created November 21, 2011 08:38
Getting Nokogiri to install on Lion
# using rvm with ruby-1.9.2
# latest version 2.7.8 2011-09-16
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar xvfz libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.8
@thbar
thbar / rvm-install.sh
Created December 1, 2011 17:06 — forked from robinator/rvm-install.sh
RVM installation for Flywheel
## As root
# https://rvm.beginrescueend.com/rvm/install/
groupadd rvm
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
# add below to ~/.bash_profile at bottom (for both root and deploy)
[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'
# add below to ~/.gemrc at bottom (for both root and deploy)
install: --no-rdoc --no-ri
@thbar
thbar / vagrant-capistrano
Created December 13, 2011 09:45 — forked from fadhlirahim/vagrant-capistrano
Vagrant capistrano config bit
# Don't forget to run this vagrant command first
# vagrant ssh-config >> ~/.ssh/config
set :user, 'vagrant'
set :run_method, :sudo
role :app, '33.33.33.10'
ssh_options[:keys] = `vagrant ssh_config | grep IdentityFile`.split.last