Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob Dawson codebox

View GitHub Profile
@codebox
codebox / gist:76aabe9391daaadd9662736547463ab0
Last active Jul 22, 2017
OSX shell command to read aloud the content of a web page
View gist:76aabe9391daaadd9662736547463ab0
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
@codebox
codebox / StrictDateFormat.java
Created Sep 29, 2011
Java class that fixes a number of SimpleDateFormat annoyances
View StrictDateFormat.java
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 / Mosaic.java
Created Sep 21, 2011
Java code to create a mosaic image from multiple small tiles (the code is a bit rough, sorry)
View Mosaic.java
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 / make_tiles.sh
Created Sep 21, 2011
Shell script to generate tiny still images extracted at 1 second intervals from a video file (requires ffmpeg)
View make_tiles.sh
#!/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