Skip to content

Instantly share code, notes, and snippets.

@fabienhinault
fabienhinault / du.awk
Created October 6, 2016 15:22
gawk -f du.awk du_full.txt | sort -nr > ./du_awk.txt
BEGIN {
FS = "\t"
#DO NOT PUT A DIR AND ITS ANCESTOR
# level[""] =
level["/cygdrive/c/45957c88bd2196d0a5954d070864"] = 37112
level["/cygdrive/c/Drivers"] = 110551
level["/cygdrive/c/Program Files"] = 11*1000*1000
level["/cygdrive/c/Perl"] = 73*1000
level["/cygdrive/c/TOOLS/logging-log4j-1.2.13"] = 10*1000
level["/cygdrive/c/WINDOWS"] = 16*1000*1000
@fabienhinault
fabienhinault / precision.py
Last active October 5, 2016 09:09
try equality after multiplying and dividing by an integer in [-1000, 1000]
# 7.9345703125E-4 = 1.625 * 2**-11 https://www.h-schmidt.net/FloatConverter/IEEE754.html
for d in [7.9345703125E-4, 8E-4]:
print(d)
n = 0
for i in range(-1000, 1000):
if i != 0 and d * i / i != d:
n = n + 1
print(n)
# 0.00079345703125
$('tr.pdct').each(function(){console.log($(this)[0].attributes['data-ref'].value);});
ch6 0Z
Q: When do you get multiline error messages?
R: When the error is detected while TEX is processing some higher-level commands.
/drawQrPath
{
newpath
%...qr path from http://goqr.me/
31 32 moveto
32 32 lineto
32 33 lineto
31 33 lineto
31 32 lineto
32 32 moveto
@fabienhinault
fabienhinault / croppdf.bash
Last active September 13, 2016 19:28
Attempts to crop a pdf file in order to simulate a scale
gs -o cropped.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595.32
gs -o cropped.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595.32 -dDEVICEHEIGHTPOINTS=421 -dFIXEDMEDIA -c " 0 0 595.32 421 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595.32 -dDEVICEHEIGHTPOINTS=421 -dFIXEDMEDIA -c " 0 421 translate" -c " 0 0 595.32 421 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595.32 -dDEVICEHEIGHTPOINTS=421 -dFIXEDMEDIA -c " 0 421 595.32 842 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=595.32 -dDEVICEHEIGHTPOINTS=421 -dFIXEDMEDIA -c " 0 421 translate" -c " 0 421 595.32 842 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -c " 0 421 translate" -c " 0 421 595.32 842 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -c " 0 421 translate" -c " 0 0 595.32 421 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -c " 0 0 595.32 421 rectclip" -f final.pdf
gs -o cropped2.pdf -sDEVICE=pdfwrite -c
@fabienhinault
fabienhinault / unefois.lob
Last active September 7, 2016 11:45
macro pour générer les fiches d'inscriptions personnalisées "dites-le nous une seule fois".
REM ***** BASIC *****
Sub Main
Dim Doc As Object
Dim Url As String
Dim Dummy() 'It is an (empty) array of PropertyValues
Dim oDocProps as object
Dim oProps as object
Dim iRow as Integer
@fabienhinault
fabienhinault / link_all_txts.sh
Created November 4, 2015 22:28
create symbolic links to lots of files
@fabienhinault
fabienhinault / combinations.rkt
Created September 13, 2015 05:26
combinations
#lang racket
(define (combinations xs n)
(cond ((equal? n 0)
'(()))
((equal? n (length xs))
(list xs))
(else
(append (map (lambda (ys) (cons (car xs) ys))
(combinations (cdr xs) (- n 1)))
@fabienhinault
fabienhinault / A.mp3
Last active August 29, 2015 14:24
alphabet.html