Skip to content

Instantly share code, notes, and snippets.

View codebox's full-sized avatar

Rob Dawson codebox

View GitHub Profile
@codebox
codebox / make_tiles.sh
Created September 21, 2011 19:40
Shell script to generate tiny still images extracted at 1 second intervals from a video file (requires ffmpeg)
#!/bin/bash
# Set things up...
INFILE=$1
if [[ -z "$INFILE" || ! -f $INFILE ]]; then
echo Please supply the location of a video file
exit 1
fi
OUTDIR=./tiles
STEP=1
@codebox
codebox / Mosaic.java
Created September 21, 2011 19:46
Java code to create a mosaic image from multiple small tiles (the code is a bit rough, sorry)
package uk.org.codebox.mosaic;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@codebox
codebox / StrictDateFormat.java
Created September 29, 2011 16:30
Java class that fixes a number of SimpleDateFormat annoyances
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Helper class providing a thread-safe, null-safe wrapper around a DateFormat
* object configured to perform 'strict' (i.e. non-lenient) date parsing.
*
* @author rob.dawson
@codebox
codebox / gist:76aabe9391daaadd9662736547463ab0
Last active July 22, 2017 17:02
OSX shell command to read aloud the content of a web page
URL=http://pun.me/pages/dad-jokes.php
curl -L $URL | tr '\n' ' ' | egrep -o '<(title|h\d|p|li)( [^>]*>|>).*?</\1>' | sed -E 's/<[^>]*>//g' | say