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 / 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 <mansour@oxplot.com>
#
# 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))
@s-leroux
s-leroux / im.sh
Last active October 30, 2016 09:47
Blueish frame
#!/bin/bash
COLOR="#59838c"
for f in FRAME-*.png; do convert \( -size 1920x1080 xc:black \) \( $f -alpha Off -level 10%,100% -negate \) -compose CopyOpacity -composite ${f/FRAME/ALPHA}; done
for f in ALPHA-*.png; do convert \( -size 1920x1080 xc:"$COLOR" \) \( $f \) -compose Over -composite ${f/ALPHA/OVER}; done