Skip to content

Instantly share code, notes, and snippets.

@erluko
erluko / fixpaths.sh
Created December 8, 2012 22:25
Fix the mess that /usr/libexec/path_helper made of my $PATH
#!/bin/sh
#Reorders $PATH, removes duplicates
prefixes="$1"
if [ '--' = "$prefixes" ]; then
shift;
prefixes="$1";
else
if echo "$prefixes" | grep -q '^\(\|--help\|-h\)$' ; then
@erluko
erluko / ReturningException.java
Created November 19, 2011 23:09
Example of potential performance benefit of early exit in reduce
/* don't use this, it's just for a timing demonstration */
public class ReturningException extends RuntimeException {
transient public final Object data;
transient public final Object context;
public ReturningException(Object o){
this(null, o);
}
public ReturningException(Object c, Object o){
super("Not really an exception");