Skip to content

Instantly share code, notes, and snippets.

View jpcaruana's full-sized avatar

Jean-Philippe Caruana jpcaruana

View GitHub Profile
@jpcaruana
jpcaruana / spec.log
Created August 5, 2014 09:25
buildr: rake spec --trace
Compiling Java libraries ...
(in /home/jp/src/open_source/buildr, development)
** Invoke buildr (first_time)
** Invoke buildr:java (first_time)
** Invoke buildr:scala (first_time)
** Invoke buildr:extra (first_time)
** Invoke buildr:java
** Invoke buildr:scala
** Invoke buildr:extra
** Invoke buildr
@jpcaruana
jpcaruana / LocaleRule.java
Created January 31, 2014 10:35
set your Locale in your tests
package fr.barreverte.test;
import org.junit.rules.ExternalResource;
import java.util.Locale;
public class LocaleRule extends ExternalResource {
private final Locale toRestore;
private final Locale forTest;
@jpcaruana
jpcaruana / polish.rb
Created October 31, 2012 11:10
Reverse Polish notation (ruby)
require "test/unit"
OPERATIONS = {
"+" => lambda { |a, b| a + b },
"-" => lambda { |a, b| a - b },
"*" => lambda { |a, b| a * b },
"/" => lambda { |a, b| a / b }
}
def eval_polish(expression)
@jpcaruana
jpcaruana / polish.py
Created October 29, 2012 13:17
Reverse Polish notation (python)
# -*- coding: utf-8 -*-
import unittest
operators = {
'+': lambda a, b: a + b,
'-': lambda a, b: a - b,
'*': lambda a, b: a * b,
'/': lambda a, b: a / b
}
@jpcaruana
jpcaruana / bad_tag.txt
Created September 27, 2012 14:43
convertir un projet SVN vers git
* dac3ecb [fix] bug
* ddee3c9 VERSION='0.23.0-SNAPSHOT'
* 8b4c9ec VERSION='0.22.6'
| * 6bdfaf5 (tag: 0.22.6) Release 0.22.6
|/
* 0b2b6c1 - injecteur bench : reset compteur par file
* 7e00283 - injecteur bench : stopper les acteurs en fin de cycle
@jpcaruana
jpcaruana / multi.py
Created September 19, 2012 16:37
non blocking HTTP GET
# -*- coding: utf-8 -*-
from datetime import datetime
import multiprocessing, time, urllib2
class Browser(object):
def __init__(self):
self.p = None
def request(self, s):
@jpcaruana
jpcaruana / xinput list
Created August 10, 2012 15:35
xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Optical Mouse id=8 [slave pointer (2)]
⎜ ↳ HID 046a:0023 id=10 [slave pointer (2)]
⎜ ↳ TypeMatrix.com USB Keyboard id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ HID 046a:0023 id=9 [slave keyboard (3)]
@jpcaruana
jpcaruana / switch_dv_fr.sh
Created August 10, 2012 15:26
switch between dvorak and azerty keyboards
#!/bin/bash
kbd=`setxkbmap -query | grep layout | awk '{print $2}'`
if [ 'fr' = $kbd ]
then
notify-send 'Keyboard is now Dvorak'
setxkbmap dvorak en -option compose:ralt
else
notify-send 'Keyboard is now French'
@jpcaruana
jpcaruana / lxde-rc.xml
Created August 10, 2012 15:20
binding pour switcher entre les claviers dvorak/azerty
<keybind key="W-F5">
<action name="Execute">
<command>~/bin/switch_dv_fr</command>
</action>
</keybind>
@jpcaruana
jpcaruana / dvorak
Created August 10, 2012 15:15
clavier dvorak avec compose (pour les accents)
setxkbmap dvorak en -option compose:ralt