Skip to content

Instantly share code, notes, and snippets.

View mathieue's full-sized avatar

Mathieu Elie mathieue

View GitHub Profile
@whiteinge
whiteinge / fabfile.py
Created November 13, 2009 17:16
Example fabric script with VirtualBox automation
# -*- coding: utf-8 -*-
"""MyCompany Fabric script.
* Deploy code
* Set up a local development environment
There are two ways to deploy the myrepo code:
1. :func:`deploy` will do a full virtualenv installation/update and expand a
tarball of the specified git revision (defaults to HEAD) to a timestamped
# command line can be amazing and so simple ( just a terminal! ) at the same time
# rsyncing to current dir as dest? watch dir size grows in real time!
watch -n 1 'du -sh .'
# cut word left of cursor
<ctrl-w>
# yank (paste) last cut/kill (ex: see <ctrl-w> )
<ctrl-y>
@mmai
mmai / gist:734893
Created December 9, 2010 16:04
Trouve les tweets de Centquarante ne contenant pas 140 caractères
#Trouve les tweets de Centquarante contenant un nombre de caractères différent de 140
#cf. http://twitter.com/#!/Centquarante/status/12787915516026880
#ruby 1.9 requis pour la détection automatique de l'encodage
require 'twitter'
def get_tweets(user, options)
lastid = false
Twitter.user_timeline(user, options).each do |r|
puts r.text.size.to_s + ":#{r.id}:#{r.text}" if r.text.size != 140
@bcg
bcg / client.rb
Created April 6, 2011 20:46
Eventmachine + ZMQ + Redis Server
require 'em-zeromq'
Thread.abort_on_exception = true
EM.run do
ctx = EM::ZeroMQ::Context.new(1)
socket = ctx.connect( ZMQ::PUSH, 'tcp://127.0.0.1:15000')
loop do # ZOMG you are blocking!?
@mathieue
mathieue / rmvm-system-wide.sh
Created September 9, 2011 21:23
System wide RVM
sudo su
bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)
apt-get install zlib1g-dev libssl-dev libreadline5-dev
rvm install 1.9.2
rvm 1.9.2
add rvm script below to your .bashrc and to /root/.bashrc
# Load RVM if it is installed,
# first try to load user install
# then try to load root install, if user install is not there.
@markoa
markoa / deploy.rb
Created October 10, 2011 13:31
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
@codingjester
codingjester / duckduckgo.rb
Created January 14, 2012 19:28
DuckDuckGo Ruby API
require 'net/http'; require 'json'; JSON.parse(Net::HTTP.get(URI("http://duckduckgo.com/?q=#{query}&o=json")))
@thbar
thbar / README.MD
Created April 18, 2012 09:43
Ruby JSON pipe pretty-printer

A quick ruby command line to pretty-print piped json.

Usage

Put this somewhere in your path, with chmod +x, then:

curl http://myapp.com/stuff.json | json

@mikhailov
mikhailov / 0. nginx_setup.sh
Last active April 2, 2024 14:57
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@xively-gists
xively-gists / WiFiXivelyTutorial.ino
Last active December 17, 2015 05:58
Arduino wifi tutorial code
/*
##Xively WiFi Sensor Tutorial##
This sketch is designed to take sensors (from photocell) and upload the values to Xively
at consistant intervals. At the same time it gets a setable value from Xively to adjust the brigthness
of an LED. This sketch is reusable and can be adapted for use with many different sensors.
Derived from Xively Ardino Sensor Client by Sam Mulube.
By Calum Barnes 3-4-2013
BSD 3-Clause License - [http://opensource.org/licenses/BSD-3-Clause]
Copyright (c) 2013 Calum Barnes