{{ message }}

Instantly share code, notes, and snippets.

# Søren Lund soren

Created Dec 6, 2011
An init script for the default "shell" on windows: cmd.
View dev_setup.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @echo off rem This is an init script for the default "shell" on windows: cmd. rem rem You can try it out by calling cmd /k c:\path\to\file\.cmdrc.bat rem rem For a more permanent solution do the following: rem rem 1) copy this file to %USERPROFILE% rem 2) Set the AutoRun key like this:
Created Mar 5, 2012
Create a new JSPWiki instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #!/bin/bash SRCDIR=/root/build/JSPWiki WIKIDIR=/jspwiki CONFDIR=/etc/jspwiki DEPLOYDIR=/opt/java/tomcat/conf/Catalina/localhost test -z $1 && echo "USAGE:$(basename $0) wikiname" && exit 1 test -d$WIKIDIR/$1 && echo "The name$1 is already used" && exit 1
Created Mar 17, 2012
Perl script that can determine the version of a java class file
View java_class_version.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #!/usr/bin/env perl use warnings; use strict; use Pod::Usage; =head1 NAME java_class_version.pl - determines the version of a java class file
Created Jul 6, 2012
ScanCalc - a small JavaScript utility to convert between centimeters (cm), pixels and dots/inch (dpi).
View scancalc.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 ScanCalc
Created Nov 15, 2012
Hacker example from http://www.csis.pace.edu/~bergin/patterns/ppoop.html
View PrintOS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import java.util.HashMap; import java.util.Map; import com.google.common.collect.ImmutableMap; public class PrintOS { private static final Map MSG = ImmutableMap .of("unix", "This is a UNIX box and therefore good.", "windows", "This is a Windows box and therefore bad.",
Created Jan 16, 2013
A simple Java utility to test database connections using JDBC.
View JdbcCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import java.io.Console; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.HashMap; import java.util.Map; public class JdbcCheck {
Created Oct 7, 2013
Example of my Java code formatting rules.
View JavaCodeSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package net.twonky.demo; import java.util.HashMap; // Always import fully qualified packages import java.util.Map; // The imports should be sorted alphabetically // import third party classes here, e.g. import oracle.jdbc.pool.OracleConnectionCacheImpl; // import you own classes here, e.g. import net.twonky.demo.StringUtil; /**
Created Oct 29, 2013
A Hadoop Word Count example using built-in map and reduce classes. Tested with Java 1.6 and Hadoop 1.0.4.
View WordCount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters