Skip to content

Instantly share code, notes, and snippets.

View jpcaruana's full-sized avatar

Jean-Philippe Caruana jpcaruana

View GitHub Profile
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@tdd
tdd / config-bash-pour-un-prompt-git-de-tueur.bash
Last active April 17, 2024 10:04
Config Bash pour un prompt Git de tueur
# STEP 1: ENSURE COMPLETION AND PROMPT FUNCTION ARE LOADED
# ========================================================
# OPTION 1: If on OSX using Homebrew:
#
# source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
# source $(brew --prefix)/etc/bash_completion.d/git-completion.bash
# OPTION 2: If on OSX using built-in Git (also works on ZSH):
#
@jpcaruana
jpcaruana / .gitconfig
Created January 11, 2011 16:48
ma conf de git
[color]
branch = auto
diff = auto
status = auto
interactive = auto
[user]
name = Jean-Philippe CARUANA
email = jp@barreverte.fr
[alias]
last = cat-file commit HEAD
@cacoco
cacoco / precompiler.rb
Last active September 25, 2015 12:28
Buildr Extension for precompiling JSP files.
module Precompiler
include Extension
first_time do
# Define task not specific to any projet.
desc 'Precompile jsps'
Project.local_task('precompile' => 'compile') { |name| "Precompiling #{name}" }
end
before_define do |project|
@rbscott
rbscott / elasticsearch.conf
Created June 28, 2011 19:46
upstart job for elastic search
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@mikeyk
mikeyk / reconnect.diff
Created June 30, 2011 21:05
Automatically retry on AutoReconnect exception in pymongo
diff --git a/pymongo/connection.py b/pymongo/connection.py
index b444f50..7635c78 100644
--- a/pymongo/connection.py
+++ b/pymongo/connection.py
@@ -46,6 +46,7 @@ from pymongo import (database,
helpers,
message)
from pymongo.cursor_manager import CursorManager
+from pymongo.decorators import reconnect
from pymongo.errors import (AutoReconnect,
@aisipos
aisipos / jsonp-in-flask.py
Created July 20, 2011 01:20 — forked from farazdagi/jsonp-in-flask.py
JSONP in Flask
import json
from functools import wraps
from flask import redirect, request, current_app
def support_jsonp(f):
"""Wraps JSONified output for JSONP"""
@wraps(f)
def decorated_function(*args, **kwargs):
callback = request.args.get('callback', False)
if callback:
@simple
simple / gist:1364716
Created November 14, 2011 18:43 — forked from kwilczynski/gist:1170467
Upstart configutation file for MongoDB with NUMA support
# Ubuntu upstart file at /etc/init/mongodb.conf
limit nofile 32768 32768
kill timeout 300 # wait 300s between SIGTERM and SIGKILL.
pre-start script
mkdir -p /data/mongodb &> /dev/null
mkdir -p /data/logs/mongo &> /dev/null
chown mongodb:nogroup /data/mongodb &> /dev/null
@jbpotonnier
jbpotonnier / nimportequoi.py
Created December 8, 2011 16:10
fun avec bottle, pystache et ... redis
from bottle import Bottle
import bottle
import pystache
import redis
import json
app = Bottle()
redisse = redis.Redis()
def mustache(template, context):
@bamthomas
bamthomas / mod_http_presence.erl
Created December 14, 2011 10:10
module http ejabberd
-module(mod_http_presence).
-behavior(gen_mod).
-include("ejabberd.hrl").
-include("jlib.hrl").
-export([start/2, stop/1, on_presence/4]).
start(Host, _Opts) ->