Skip to content

Instantly share code, notes, and snippets.

View codingtony's full-sized avatar

Tony Bussières codingtony

View GitHub Profile
@codingtony
codingtony / prettyprint_xml_perl
Created May 2, 2014 12:16
Perl one liner to pretty print xml.
#Taken from http://lo-f.at/glahn/2008/01/PerlOneliners.html
perl -MXML::LibXML \
-e 'print XML::LibXML->new->parse_file($ARGV[0])->toString(1);' \
somefile.xml
import static org.junit.Assert.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
@Test
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
@codingtony
codingtony / loadScriptsCallback.js
Last active August 29, 2015 14:05
Example Sequential LoadScripts
function loadScripts(scripts, doneCallback) {
var i = 0;
var fn;
var fns = [];
var slist = [];
var load = function (s, h) {
console.log("Loading JS " + s);
@codingtony
codingtony / fixBrightness.sh
Created August 12, 2014 18:55
Fix increase brightness of screen on Linux for Intel video card
#!/bin/bash
# Inspired by http://askubuntu.com/a/469040/99692
sudo bash -c "echo 600 > /sys/class/backlight/intel_backlight/brightness"
@codingtony
codingtony / checkButorLogin.sh
Last active August 29, 2015 14:06
Script to check success of login on Butor FrameworkSSO. This script uses curl. The script will generate an ERROR if HTTP CODE != 200 OR if message type=ERROR is present in the payload returned. Exit code of this script will be 0 only if login succeed.
#!/bin/bash
USER=$1
PASSWORD=$2
LOGIN_AJAX_SERVICE=$3
if [ -z "$1" ]; then
echo "ERROR: USER REQUIRED (first parameter)";
exit 1;
fi
if [ -z "$2" ]; then
(function () {
var log, global = (function () {
return this;
}).call(null);
var ready = false;
var check = function () {
if (!ready) {
init();
}
@codingtony
codingtony / convertV4L2.sh
Last active August 29, 2015 14:14
transcode low quality cvlc
#!/bin/sh
DEST=$1
cvlc v4l2:///dev/video0 :input-slave=alsa://hw:3,0 --sout '#transcode{vcodec=h264,vb=400,venc=x264{profile=baseline},scale=Auto,width=480,height=352,acodec=mp2,ab=24,channels=2,samplerate=44100}:standard{mux=mp4, access=file, dst='$DEST'}'
@codingtony
codingtony / extractUDPDataFromPcapFile.pl
Created February 12, 2015 20:26
Little Perl program that dumps the data from UDP packets stored in a pcap file and write it to another file. Uses Net::Pcap
#!/usr/bin/perl
use strict;
use warnings;
use Net::Pcap;
use NetPacket::Ethernet qw(:types);
use NetPacket::IP qw(:protos);
use NetPacket::UDP;
@codingtony
codingtony / dvgrab.sh
Created February 13, 2015 23:27
dvgrab (Convert mini dv tapes to files)
#!/bin/sh
dvgrab --autosplit --timestamp video-