Skip to content

Instantly share code, notes, and snippets.

Arthur Embleton aembleton

Block or report user

Report or block aembleton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
aembleton / listFiles.scala
Created Sep 19, 2013
Gets a list of files in a given directory and all child directories
View listFiles.scala
* Gets a list of files in a given directory and all child directories
* @param f This is the File representing the root directory
* @return A list of File objects, each one representing a File inside f, either directly or in a sub-directory
def listFiles(f: File): List[File] = f match{
case f if f.isDirectory => f.listFiles.toList.flatMap(listFiles(_))
case f if f.isFile => List(f)
case _ => Nil
aembleton / diskspace.sql
Created May 8, 2013
Calculates used disk space on Oracle
View diskspace.sql
SELECT df.tablespace_name "Tablespace",
totalusedspace "Used MB",
(df.totalspace - tu.totalusedspace) "Free MB",
df.totalspace "Total MB",
ROUND(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)) "Pct. Free"
(SELECT tablespace_name,
ROUND(SUM(bytes) / 1048576) TotalSpace
FROM dba_data_files
GROUP BY tablespace_name
aembleton /
Created May 8, 2013
Example of iText that repeats an image all over a page and draws a semi-transparent yellow line on top.
import java.awt.Color;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
package com.jandrewthompson;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
aembleton / Frequency of email address domains
Created Mar 22, 2013
Find the frequency of email address domains from your email table.
View Frequency of email address domains
select substring_index(value, '@',-1) as email, count(*) as frequency FROM emailTable where name="EmailAddress" group by email order by frequency desc;
View Detect versions of IE in Javascript
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
package net.blerg.oracleToMysql.util;
import java.util.LinkedList;
import java.util.List;
public class PatternReplace {
public static String replace (String string, String pattern, String replacement, char wildcard, char escapeChar, boolean ignoreCase) {
//tokenise against the pattern
aembleton /
Created Aug 29, 2012
Provides a way to produce an information box surrounded by a char such as *.
import java.util.LinkedList;
import java.util.List;
* Provides a way to produce an information box surrounded by a char such as *. To use, add lines by calling {@link #add(String)} and then call {@link #getStringsInBox(char)} to get a String that can
* be put into a System.out.println call or used elsewhere that is formatted.
* @author Arthur Embleton
package utils;
import java.util.HashSet;
import java.util.Set;
public class KeyValue {
private static final char DELIMITER = ':';
private static final char KEY_VALUE_DELIMITER = ',';
private static final char ESCAPE_CHAR = '\\';
aembleton / build.xml
Created Aug 21, 2012
Ant script that packages up all of the jars into a single executable jar
View build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="jar">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="DataPersist.classpath">
<pathelement location="bin"/>
<pathelement location="lib/commons-cli-1.1.jar"/>
<pathelement location="lib/commons-io-1.2.jar"/>
You can’t perform that action at this time.