Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathieu Arnold mat813

View GitHub Profile
View 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 Apr 10, 2015
Use pdftk to shuffle even and reverse odd scanned pages in a single document
View shuffle.sh
#!/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 Aug 29, 2015
Build the FreeBSD docs
View build.sh
#!/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,
View stretch_box.rb
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
View lines_grid.rb
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|
View gist:975210
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
rescan iTunes library…
View rescan-itunes.scpt
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
View film.rb
#!/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
View film.html
<?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 Jun 15, 2011
Rollover zones with OpenDNSSEC
View rollover.sh
#!/bin/sh
if [ -z $1 ]
then
echo "$0 zones"
exit 1
fi
for zone in $@
do