Skip to content

Instantly share code, notes, and snippets.

import scala.collection.mutable
/**
* Code to solve a type of puzzle known as a "spelling bee" or "word hive".
*
* M I
* T U A
* N O
*
@cmcenearney
cmcenearney / GameOfLife.hs
Created February 27, 2015 03:12
GameOfLife.hs
{-
adapted frm https://github.com/psfblair/ConwayLife/blob/master/LifeCore/Life.fs
-}
module GameOfLife where
import Data.Set
import qualified Data.Set as Set
import Test.Hspec
import Test.HUnit
@cmcenearney
cmcenearney / ApacheCommonsEmail.java
Last active May 17, 2018 17:42
email from Java with Apache Commons and Mandrill
/*
simple text emails
looks for environment variables for the Mandrill credentials, as on Heroku for instance
if not found, checks a prop file
*/
import org.apache.commons.mail.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.*;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.perf4j.LoggingStopWatch;
import org.perf4j.StopWatch;
import java.io.File;
import java.io.IOException;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import java.io.*;
/*
* Your assignment: The DirectoryCopier class will copy all the files in one
* directory to another directories in series (not in parallel). Use that code
* as a starting point and modify this class to copy files in parallel using threads.
*/
public class AsyncDirectoryCopier {
@cmcenearney
cmcenearney / Sort.java
Last active December 20, 2015 11:59
MergeSort with merge() that could be better :-)
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import java.util.Arrays;
public class Sort {
private Sort() {
super();
}
/**
@cmcenearney
cmcenearney / git_copy_changed.sh
Last active December 17, 2015 06:59
git fun: list files changed by most recent commit, copy to dev server (or wherever)
#!/bin/bash
# list files changed by the last commit
# and copy them to a target dir
TARGET=$1
MOST_RECENT=$(git log -n 1 --pretty=format:'%h')
PREV=$(git log --skip=1 -n 1 --pretty=format:'%h')
echo "Coping to $TARGET"
for i in $(git diff --name-only $MOST_RECENT $PREV)