Skip to content

Instantly share code, notes, and snippets.

@fabienhinault
fabienhinault / append.bash
Created March 4, 2014 12:07
append the content of files named in lines beggining with "-- append "
#!/bin/sh
# remove everything after -- /******
sed -i "/-- \/\*\*\*\*\*\*\*/q" $1
# append the content of files named in lines beggining with "-- append "
sed -n "/^-- append / s%^-- append \(.*\)$%cat \$(cygpath '\1') >> $1; echo >> $1% p" < $1 | sh
@fabienhinault
fabienhinault / dialog-diff-docx.js
Created March 5, 2014 10:00
TortoiseSVN's diff-dox.js modified to select the files with a dialog box
//
// TortoiseSVN Diff script for Word Doc files
//
// Copyright (C) 2004-2008 the TortoiseSVN team
// This file is distributed under the same license as TortoiseSVN
//
// Last commit by:
// $Author$
// $Date$
// $Rev$
#!/bin/sh
find ./ \( -name *.cpp -o -name *.h -a ! -name version.h \) -exec ./markupfile.bash "{}" \;
#!/bin/sh
localdir=$(dirname $0)
gen=$(realpath $localdir/../Generation_Int)
files=$localdir/tocopy
copy_debug()
{
KBD FHI01 "Français - Custom"
COPYRIGHT "(c) 2012 FRANCE TELECOM"
COMPANY "FRANCE TELECOM"
LOCALENAME "fr-FR"
LOCALEID "0000040c"
from PIL import Image
import PIL.ImageOps
import glob
for f in glob.glob('./*.bmp'):
image = Image.open(f).convert("RGB")
inverted_image = PIL.ImageOps.invert(image)
inverted_image.save(f)
#lang s-exp framework/keybinding-lang
(keybinding "?:c:m:l" (λ (editor evt) (send editor insert "λ")))
import urllib
import os
import lxml.html
import re
doc = lxml.html.parse("http://www.assemblee-nationale.fr/qui/xml/liste_alpha.asp?legislature=11").getroot()
doc.make_links_absolute()
birth = re.compile('[0-9][0-9]?e?r? \\S+ [0-9]{4}')
name = re.compile('<[Hh]1[^>]*?>(.*?)</[Hh]1>')
#!/bin/bash
find -name *.txt | grep "[0-9]\{8\}-[0-9]\{6\}\.[0-9]\{3\}" | sed -n "s/\(^.*\)[0-9]\{8\}-[0-9]\{6\}\.[0-9]\{3\}-\(.*$\)/mv '&' '\1\2'/p" | sh
i=2
while (( $i<10 ))
do
find -name "*\[0$i\].txt" | sed -n "s/\(^.*\)\[0$i\]\(\.txt$\)/cat '&' >> '\1\2' \&\& rm '&'/p" | sh
let "i++"
done
find -name *.txt -print0| xargs -0 sed -i~ -f ./cmp.sed
// -*- javascript -*-
// utility functions
if (!Array.prototype.reduce)
{
Array.prototype.reduce = function(fun /*, initial*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();