Skip to content

Instantly share code, notes, and snippets.

@bamthomas
bamthomas / app.js
Last active December 28, 2015 17:29
Atelier emberjs - 2e épisode
// pour memoire
App = Ember.Application.create();
var marks = [
{id: '1', title: 'barreverte', url: "http://barreverte.fr"},
{id: '2', title: 'leanagilecamp', url: "http://leanagilecamp.fr"},
{id: '3', title: 'ansamb', url: 'http://www.ansamb.com'}
];
App.Router.map(function () {
@bamthomas
bamthomas / gist:7168175
Last active December 26, 2015 14:49
Get subdir of git repository
git archive --remote=<url_repo> <branche> [<chemin>] | tar xvf
@bamthomas
bamthomas / pub_sub_redis.py
Created November 28, 2012 22:16
Pub/Sub redis python
from multiprocessing.process import Process
import time
import redis
def pub(myredis):
for n in range(10):
myredis.publish('channel','blah %d' % n)
time.sleep(5)
def sub(myredis, name):
@bamthomas
bamthomas / blocage.java
Created October 18, 2012 07:36
Bascule
private int calculepalier(StringBuffer buffer, int chiffre, Chiffre chiffreCourant, Chiffre precedent) {
int nombrePalier = chiffre / chiffreCourant.chiffreArabe;
for (int i = 0; i < nombrePalier; i++) {
if (chiffre >= chiffreCourant.chiffreArabe) {
buffer.append(chiffreCourant.name());
chiffre -= chiffreCourant.chiffreArabe;
}
}
if (chiffre == chiffreCourant.chiffreArabe - precedent.chiffreArabe) {
buffer.append(precedent.name());
@bamthomas
bamthomas / ChiffreRomain.java
Created October 17, 2012 22:12
Chiffre Romain TDD
package bam;
import static bam.ChiffreRomain.Chiffre.*;
import static java.lang.Math.abs;
import static java.util.Arrays.asList;
public class ChiffreRomain {
public final String chiffreRomain;
enum Chiffre {
#!/bin/bash
ORIGINAL=$1
mv $ORIGINAL/$ORIGINAL.jpg $ORIGINAL/cover.jpg
ALBUM_PATH=`echo $ORIGINAL | awk -F '-' '{print $1"/"$2}'`
mkdir -p "$ALBUM_PATH"
mv $ORIGINAL/* "$ALBUM_PATH/"
rmdir $ORIGINAL
@bamthomas
bamthomas / encode_music_with_single_image
Created September 7, 2012 11:01
encode_music_with_single_image
MP3=music.mp3
ffmpeg -loop_input -vframes `mp3info -p "%S" $MP3` -r 1 -f image2 -i cover.jpg -i $MP3 -ab 128k video.avi
@bamthomas
bamthomas / set_typematrix_dvorak_mapping
Created August 1, 2012 15:11
TypeMatrix set dvorak mapping
ID=`xinput list | grep TypeMatrix | grep keyboard | sed 's/.*id=\([0-9]*\).*/\1/'` && setxkbmap -device $ID dvorak -option compose:ralt
# mapping insert on mail key
xmodmap -e 'keycode 163=Insert'
@bamthomas
bamthomas / toggle_azerty_querty
Created July 7, 2012 12:00
toggle_azerty_querty
#!/bin/bash
if ( setxkbmap -query | grep fr > /dev/null )
then setxkbmap us -option compose:ralt
else setxkbmap fr -option ""
fi
@bamthomas
bamthomas / .tmux.conf
Created June 4, 2012 20:49
tmux config
# prefix is CTRL-B and CTRL-X
set -g prefix C-b,C-x
# enable CTRL-B and CTRL-X under other programms (like vim) - you'll have to press twice le combination to have the ancien one
bind C-b send-prefix
bind C-x send-prefix
# UTF-8
set-option -g status-utf8 on
set-window-option -g utf8 on