Skip to content

Instantly share code, notes, and snippets.

View s-leroux's full-sized avatar

Sylvain Leroux s-leroux

View GitHub Profile
@s-leroux
s-leroux / gist:96f03bb171e00d049a044bd7a10e105a
Created April 22, 2018 09:53
Ardour region with curved fade in and fade out
<Region name="jg-032316-sfx-footsteps-casual-shoes-on-rocks.2" muted="0" opaque="1" locked="0" video-locked="0" automatic="0" whole-file="0" import="0" external="1" sync-marked="0" left-of-split="0" right-of-split="0" hidden="0" position-locked="0" valid-transients="0" start="90112" length="48835" position="96044" beat="4.0018333333333329" sync-position="0" ancestral-start="0" ancestral-length="0" stretch="1" shift="1" positional-lock-style="AudioTime" layering-index="0" envelope-active="0" default-fade-in="0" default-fade-out="0" fade-in-active="1" fade-out-active="1" scale-amplitude="1" id="4279" type="audio" first-edit="nothing" source-0="4247" source-1="4249" master-source-0="4247" master-source-1="4249" channels="2">
<Envelope default="yes"/>
<FadeIn>
<AutomationList automation-id="fadein" id="4280" interpolation-style="Curved" state="Off">
<events>0 1.0000000116860974e-07
1.9393939971923828 0.047581917240722742
3.8787879943847656 0.095056046128510166
5.8181819
@s-leroux
s-leroux / snd2png.sh
Last active April 12, 2018 10:59
A crude script to obtain a graphical representation of a stereo sound waveform.
#!/bin/bash
INFILE="$1"
OUTFILE="$2"
DATFILE="${INFILE}.dat"
SVGFILE="${INFILE}.svg"
sox "${INFILE}" "${DATFILE}"
gnuplot << EOF
# set terminal pngcairo size 750,400 enhanced font 'Verdana,10'
@s-leroux
s-leroux / gpg-fingerprint-raspberry-pi-downloads-signing-key
Created December 14, 2017 11:11
Raspberry Pi Downloads Signing Key fingerprint
gpg --recv 8738CD6B956F460C

Keybase proof

I hereby claim:

  • I am s-leroux on github.
  • I am sylvain_leroux (https://keybase.io/sylvain_leroux) on keybase.
  • I have a public key whose fingerprint is 9796 D177 578B 9B3C BFC1 3656 AB58 1F1D 1F61 C522

To claim this, I am signing this object:

@s-leroux
s-leroux / Surprise.java
Last active September 7, 2017 11:58
Demonstration of potential issue when comparing floating point numbers and integer numbers in java
//
// Tested with openjdk-8
//
// Usage:
// javac Surprise.java
// java Surprise
//
public class Surprise {
public static void main(String args[]) {
long n = Integer.MAX_VALUE;
@s-leroux
s-leroux / shape2txt
Last active July 5, 2017 13:16
GIS file converter from .shp to gnuplot data file
#!/bin/bash
# Original code by Hagen Wierstorf (http://www.gnuplotting.org)
# http://www.gnuplotting.org/code/shape2txt
# Shamelessly modified by Sylvain Leroux for the worst
function usage() {
echo "Usage:"
echo " shape2txt file.shp"
}
@s-leroux
s-leroux / extract
Last active July 6, 2017 08:55
Open source observatory data extraction and visualization.
for file in "$@"
do
tidy -q -numeric -asxhtml \
--show-warnings no \
"${file}" | \
xmlstarlet sel -T \
-t \
-m "//_:a[text()='eGovernment']" \
-m "//*[contains(@class,'coverage-description')]/_:a" \
-o "$(basename "${file}")"'|' \
@s-leroux
s-leroux / build-from-scratch.sh
Last active May 10, 2017 11:50
Build from scratch script for RainyNite Studio (https://notabug.org/caryoscelus/rainynite-studio)
#!/bin/bash
set -e
shopt -s expand_aliases
alias make='make -j9'
sudo apt-get update
sudo apt-get install -y \
libblas-dev libgsl-dev python-cairo-dev \
libgtk2.0-dev libgtkmm-2.4-dev libcairomm-1.0-dev libcairo2-dev \
@s-leroux
s-leroux / svglinkify.py
Last active January 26, 2017 15:02 — forked from oxplot/svglinkify.md
Add hyperlinks to PDFs created by Inkscape
#!/usr/bin/env python
# svglinkify.py - Add hyperlinks to PDFs generated by Inkscape
# Copyright (C) 2015 Mansour Behabadi <[email protected]>
#
# This script comes with no warranty whatsoever. Use at your own risk.
# If you decide to distribute verbatim or modified versions of this
# code, you must retain this copyright notice.
#
# Usage: svglinkify.py <svg-file> <inkscape-gen-pdf> <linkified-pdf>
# Requires:
#!/bin/bash
echo '1 2 3' > sample.data
cut -d' ' -f1,3 sample.data | read X Z
echo $((X+Z))