Skip to content

Instantly share code, notes, and snippets.

View mat813's full-sized avatar

Mathieu Arnold mat813

View GitHub Profile
@mat813
mat813 / keybase.md
Created June 3, 2014 14:30
keybase.md

Keybase proof

I hereby claim:

  • I am mat813 on github.
  • I am mat (https://keybase.io/mat) on keybase.
  • I have a public key whose fingerprint is 3AB6 9789 D2ED 1210 6440 BA5B 3A45 16F3 5183 CE48

To claim this, I am signing this object:

@mat813
mat813 / shuffle.sh
Created April 10, 2015 10:39
Use pdftk to shuffle even and reverse odd scanned pages in a single document
#!/bin/sh
if [ `expr $# % 2` -ne 0 ]
then
echo "odd number of arguments"
exit 1
fi
while [ $# -gt 0 ]
do
@mat813
mat813 / build.sh
Last active August 29, 2015 14:23
Build the FreeBSD docs
#!/bin/sh
# Needs sysutils/watchman, textproc/jq
set -e
BUILD_OBJ=/usr/home/mat/work/freebsd/doc-obj
watchman watch ${PWD} > /dev/null
# Subscribe to changes in $PWD, don't care about anything it returns,
def stretch_box(ratio, point, options, &block)
x, y = if ratio.is_a?(Array)
ratio.map(&:to_f)
else
[ratio.to_f, 1.0]
end
options[:width] = options[:width] / x
options[:height] = options[:height] / y if options.key?(:height)
point[0] += bounds.absolute_left
point[1] += bounds.absolute_bottom
def lines_grid(s1=10, s2=100)
save_graphics_state do
stroke_color('EEEEEE')
fill_color('000000')
stroke do
line_width(0.5)
0.step(bounds.right, s1).each do |i|
line([i, 0], [i, bounds.top]) if (i%s2 != 0)
end
0.step(bounds.top, s1).each do |i|
@mat813
mat813 / gist:975210
Created May 16, 2011 19:58
rib valid
function isRIBvalid(banque, guichet, compte, clef) {
var tab= "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var tab1="123456789123456789234567890123456789".split("");
while (compte.match(/\D/) != null)
compte=compte.replace(/\D/, tab1[tab.indexOf(compte.match(/\D/))]);
var compte=parseInt(compte, 10);
a=banque % 97;
a=a*100000+parseInt(guichet, 10);
a=a%97;
a=a*Math.pow(10, 11) + compte;
@mat813
mat813 / rescan-itunes.scpt
Created May 27, 2011 20:18
rescan iTunes library…
tell application "System Events"
repeat
delay 0.05
try
click UI element "Suivant" of window 1 of application process "iTunes"
end try
end repeat
end tell
#!/usr/bin/env ruby
input = $stdin.readlines.map do |l|
l.chomp!
title = true
l.split(/\s+/).inject([""]) do |acc, a|
if /^\d?\d:\d\d$/ =~ a
title = false
acc << a.sub(/^0/, '')
elsif title
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Films</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var start = 9;
var end = 23;
@mat813
mat813 / rollover.sh
Created June 15, 2011 14:05
Rollover zones with OpenDNSSEC
#!/bin/sh
if [ -z $1 ]
then
echo "$0 zones"
exit 1
fi
for zone in $@
do