Skip to content

Instantly share code, notes, and snippets.

View omnisis's full-sized avatar

Clifford James omnisis

View GitHub Profile
@omnisis
omnisis / MySqlCli.java
Created January 10, 2013 05:50
Mysql CLI Invoker
package ehcache.examples;
import java.io.*;
public class MySqlCLI {
private String mysqlBinaryPath = "/usr/local/bin/mysql";
public String getMysqlBinaryPath() {
return mysqlBinaryPath;
@omnisis
omnisis / H2EmbeddedTest.java
Last active February 29, 2020 14:16
Configuring H2 database for unit tests w/ spring
package examples.database;
import com.google.common.collect.Lists;
import examples.database.dao.PeopleDAO;
import examples.database.model.PeopleInfo;
import org.apache.commons.lang.time.StopWatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
@omnisis
omnisis / gist:4591335
Last active December 11, 2015 11:08
SML/SublimeREPL Configuration files

Contents of [~/Library/Application Support/Sublime Text 2/Packages]

  • SML
    • SML/README.md
    • SML/SML.JSON-tmLanguage
    • SML/SML.tmLanguage
    • SML/Son of Obsidion.tmTheme
  • SublimeREPL/config/SML
    • SublimeREPL/config/SML/Default.sublime-commands
      [{

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@omnisis
omnisis / sml_spec.sml
Last active January 18, 2017 23:53
Simple unit testing framework for SML
(* helper functions *)
exception AssertionFailure;
fun println(msg) = print(msg ^ "\n");
fun printStatusWithWidth(label, msg, width) = println("\t- " ^ (StringCvt.padRight #" " width msg) ^ label);
fun printStatus(label, msg) = printStatusWithWidth(label,msg,80)
fun msg_pass(msg) = printStatus("[ PASS ]", msg);
fun msg_fail(msg) = printStatus("[ FAIL ]", msg);
@omnisis
omnisis / find_leftovers.py
Last active December 12, 2015 08:39
Python script for finding all leftovers in a series of N CSV files whose records are in sorted order
#!/usr/bin/python
#############################################################################
# This script finds the "leftover records" between files containing arbitrary
# linesplits of a very large sorted CSV file. These types of files would exist
# if for example, one ran the UNIX 'split' program (breaking on line boundaries)
# on a large sorted CSV file to break it into smaller sorted CSV files but did
# not bother to ensure that no logical records (assumming records can span text lines)
# were split across files. Generally, it's impossible for a generic utility
# like 'split' to make such application-specific decisions at the time the
@omnisis
omnisis / solo.sh
Last active December 12, 2015 10:29
Bash script for avoid parallel executions
#!/bin/bash
#####################################################################
# Script to ensure that a cmd does not have parallel executions.
#####################################################################
unset LOCKFILE
while getopts l: flag; do
case $flag in
l)
@omnisis
omnisis / PartitionFunctionSnippet.java
Last active December 13, 2015 17:48
Weekly Partitioner for M/R Text keys with prefix long timestamps
package examples.mapred.partitioning;
import org.apache.commons.lang.time.DateUtils;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;
import java.util.Calendar;
import java.util.TimeZone;
public class PartitionFunctionSnippet {
/**
* Write key and value to baseOutputPath using the namedOutput.
*
* @param namedOutput the named output name
* @param key the key
* @param value the value
* @param baseOutputPath base-output path to write the record to.
* Note: Framework will generate unique filename for the baseOutputPath
*/
@SuppressWarnings("unchecked")
{
"metadata": {
"name": "Random Walks"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{