Skip to content

Instantly share code, notes, and snippets.

View elecnix's full-sized avatar

Nicolas Marchildon elecnix

View GitHub Profile
@elecnix
elecnix / junit2filesize
Created March 24, 2011 15:08
Create files whose size represents the JUnit test execution time, for visualizing with Baobab, Filelight, etc.
#!/usr/bin/ruby
require 'rexml/document'
require 'rexml/streamlistener'
require 'fileutils'
include REXML
class Listener
include StreamListener
def tag_start(name, attributes)
if name == "testcase"
@elecnix
elecnix / convert-to-hd.sh
Created April 6, 2011 22:38
Convert video to 720p HD
#!/bin/bash
#
# Scales down (or up) a video to 720p, re-encoding it as MPEG4.
#
# Useful as a Nautilus Script in Gnome.
#
# https://help.ubuntu.com/community/AndroidVideoEncoding#Expert mode: Using ffmpeg (command line)
ffmpeg -strict experimental -i "$1" -s 1280x720 -vcodec mpeg4 -b 3000k -acodec aac -ac 1 -ar 16000 -r 13 -ab 64000 "$1.shrinked.mp4"
@elecnix
elecnix / update-schema.rb
Created June 6, 2011 16:10
Apply incremental updates to a PostgreSQL database.
#!/usr/bin/ruby
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: update-schema [options]"
opts.on("-h", "--host HOSTNAME", "Database host to connect to") do |value|
options[:host] = value
@elecnix
elecnix / add-bugzid-commit-template.sh
Created September 28, 2011 02:15
bugzid in git commit message, for lazy rabbits
#!/bin/bash
# First cd to your git repo
# Execute this script.
# Create a feature branch by the name of case you are working on.
# (The branch name can include a dash followed by a keyword or two)
# Work hard.
# 'git commit' will open your editor with bugzid:1234 filled-in.
# Append a message, and voilà!
echo '#!/bin/sh
case "$2,$3" in
@elecnix
elecnix / move-to-date-folders.sh
Created December 31, 2011 02:04
Moves pictures to folders named by their date
#!/bin/bash
#
# Reads the EXIF date of all JPG files in the current folder,
# and moves the files to folders named by the date.
#
# On Ubuntu, the exif package is necessary:
# sudo apt-get install exif
for f in *.jpg *.JPG ; do
date=$(exif -t 0x9003 $f |grep Value|cut -d ' ' -f 4|tr ':' '-')
@elecnix
elecnix / get-daily-traffic.sh
Created November 14, 2012 18:30
Get DD-WRT daily traffic
# Inspired by: http://www.dd-wrt.com/wiki/index.php/WAN_Traffic_by_Month
ssh root@192.168.1.1 "nvram get traff-$(date +%m-%Y -d '-1 day')" > ~/consommation/`date +%Y-%m -d '-1 day'`.txt
@elecnix
elecnix / gist:4402143
Created December 28, 2012 21:33
Convert many jpg to a movie
# Convert many jpg to a movie
mencoder "mf://*.jpg" -mf fps=12:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -o movie.avi
# Convert a movie to an animated GIF
mplayer movie.avi -vf scale=320:240 -vo gif89a:fps=12:output=movie.gif -nosound
@elecnix
elecnix / .config-wr720n-12312
Created January 2, 2013 23:46
.config for OpenWrt on TP-Link WR720N (patch 12312)
#
# Automatically generated make config: don't edit
# OpenWrt version: Barrier Breaker (r34882)
# Tue Jan 1 22:32:14 2013
#
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_ppc40x is not set
# CONFIG_TARGET_ppc44x is not set
# CONFIG_TARGET_realview is not set
# CONFIG_TARGET_atheros is not set
@elecnix
elecnix / install-ideatorrent-0.9.1.sh
Last active December 10, 2015 16:18
Steps from an empty, minimalist Ubuntu 12.04 virtual machine to an Idea Torrent instance. See: http://www.ideatorrent.org
#
# ========================= WARNING ========================
# This is not intended to be run as-is, rather copy-pasted one line at a time!
# It contains comments with instructions to perform manually, such as opening
# a browser or configuring a VM in the VirtualBox GUI.
# ========================= WARNING ========================
#
# Launch a "12.04 LTS JeOS Ubuntu" virtual appliance (works in Virtual Box)
# https://solutionexchange.vmware.com/store/products/12-04-lts-jeos-ubuntu
# TODO: Document VM settings changes (storage caching, network as "bridge")
@elecnix
elecnix / gist:4739641
Created February 8, 2013 15:18
Setup dual rotated monitors on Linux with NVidia card and TwinView on RHEL6 with proprietary driver (310.19, nov 2012)
CTRL-ALT-F1
Login
# sudo su -
# init 3
# rm /etc/X11/xorg.conf
# nvidia-xconfig
# xinit
# nvidia-settings
X Server Display Configuration
Rotate both monitors