Skip to content

Instantly share code, notes, and snippets.

@gapato
gapato / d.json
Last active Nov 28, 2021
Multilingual mathematics dictionary
View d.json
[
{ "en" : "-",
"fr" : "-",
"de" : "-",
"it" : "-",
"terms" : [
{ "key" : "term",
"fr" : { "txt" : "terme (m), (pré)facteur (m), coéffiecient (m)" },
"en" : { "txt" : "term, (pre)factor, coefficient" },
"de" : { "txt" : "Glied (m), (Vor)Faktor (m), Koeffizient (m)" },
View pdfjoin
#!/bin/zsh
OUT=${1:r}.joined.${1:e}
cmd="qpdf --empty --pages"
for i in $*; do;
cmd="$cmd '$i'"
done
@gapato
gapato / dic.csv
Last active Jun 1, 2018
International bicycle dictionary
View dic.csv
FR EN IT DE
1 vélo (m)/bicyclette (f) bike/bicycle bicicletta (f) Fahrrad (nt)
2 cadre (m) frame telaio (m) Rahmen (m)
3 fourche(l) fork forcella (f) Gabel (f)
4 guidon (m) handlebar manubrio (m) Lenker (m)
5 roue (f) wheel ruota (f) Laufrad (nt)
6 jante (f) rim cerchio (m) Felge (f)
7 moyeu (m) hub mozzo (m) Nabe (f)
8 rayon (m) spoke raggio (m) Speiche (f)
9 pneu (m) tire (US)/tyre (UK) copertone (m) Reifen (m)
@gapato
gapato / equipe12.sh
Created Jan 19, 2014
lequipe.fr live stream via rtmpdump and vlc
View equipe12.sh
#!/bin/bash
app='equipetv_live21/'
flashVer='LNX 11,2,202,332'
swfUrl='http://www.lequipe21.fr/jwplayer/jwplayer.flash.swf'
tcUrl='rtmp://vipwowza.yacast.net/equipetv_live21/'
pageUrl='http://www.lequipe21.fr'
host='vipwowza.yacast.net'
playpath='live21'
bufferSize=2000 # milliseconds
@gapato
gapato / rotate.sh
Created Jun 6, 2013
Simple script to toggle rotation of the screen of a Dell Latitude XT2 AND fixing the touchscreen input direction using xrandr. This is probably not generic enough, you might need to tweak the values (LVDS1 and sed regexp) to match your system.
View rotate.sh
#!/bin/bash
#
# Very small script to fix touchscreen axis on a Latitude XT2 when in portrait mode
# (linux, xrandr)
#
rotation=$(xrandr | head -n1 | sed 's/.*current \([^,]\+\),.*/\1/')
if [ "$rotation" == '1280 x 800' ]
@gapato
gapato / jcdecaux.py
Created May 18, 2013
some trivial stuff to plot jcdecaux data
View jcdecaux.py
import math, json, glob, time
from numpy import *
from matplotlib.pyplot import *
from matplotlib import animation
# http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python
def deg2num(lat_deg, lon_deg):
lat_rad = math.radians(lat_deg)
x = (lon_deg + 180.0) / 360.0
View wien.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gapato
gapato / adjacence.py
Last active Aug 29, 2015
Plot collaboration graph from list of papers
View adjacence.py
#!/usr/bin/python
from __future__ import division
import sys
import csv
import numpy # MATLAB-like numerical library
import networkx as nx # To plot the graph
import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch, Circle
@gapato
gapato / elevator.js
Created Feb 8, 2015
ElevatorSaga try
View elevator.js
{
init: function(elevators, floors) {
document.elevators = elevators;
document.way = function() {
c = this.currentFloor();
if (this.destinationQueue.length === 0) {
return null;
}
@gapato
gapato / scomp.py
Last active Aug 29, 2015
Compare series
View scomp.py
from numpy import genfromtxt, average, median, std, percentile
from sys import argv, exit
if len(argv) < 3:
print 'Usage: {0} <series1.txt> <series2.txt> [map lambda]'.format(argv[0])
exit(1)
lam = None
if len(argv) == 4:
lam = eval(argv[3])