Skip to content

Instantly share code, notes, and snippets.

@lpar
lpar / makerepo
Created February 4, 2014 17:42
Shell script to make a shared Git repository
#!/bin/sh
CMDNAME=`basename $0`
GROUP=$1
REPODIR=$2
if [ -z $REPODIR ]; then
echo "usage: $CMDNAME <group> <dir>"
echo "creates a shared Git repository for group <group> in the specified directory"
exit 0
@lpar
lpar / corba.js
Created March 31, 2014 19:53
How to access an IBM Domino server from JDK 8 command-line JavaScript, using CORBA and DIIOP.
/*jshint indent:2 */
/*global Packages */
// Sample JavaScript CORBA/IIOP code for JDK 8 and Domino 9.0.2
// Run with jrunscript -cp DOMINO_JARS corbatest.js
// where DOMINO_JARS contains Domino.jar and NCSO.jar from your Domino server
// install.
/**
* Opens a connection to a Domino server via CORBA/DIIOP, and returns a Domino
@lpar
lpar / mbox2maildir.pl
Created May 15, 2015 13:59
Simple Perl script for mbox to Maildir conversion - I used this and it worked for me, YMMV
#! /usr/bin/perl
# put into the public domain by Bruce Guenter <bruceg@em.ca>
# based heavily on code by Russell Nelson <nelson@qmail.org>, also in
# the public domain
# NO GUARANTEE AT ALL
#
# Creates a maildir from a mbox file
# Assumes that nothing is trying to modify the mailboxe
# version 0.00 - first release to the public.
@lpar
lpar / 10-mail.conf
Created May 15, 2015 14:13
Main Dovecot configuration file /etc/dovecot/conf.d/10-mail.conf
##
## Mailbox locations and namespaces
##
# Location for users' mailboxes. The default is empty, which means that Dovecot
# tries to find the mailboxes automatically. This won't work if the user
# doesn't yet have any mail, so you should explicitly tell Dovecot the full
# location.
#
# If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u)
@lpar
lpar / md5daemon
Created June 17, 2011 20:23
Automatic MD5 checksum generating daemon for use with vsftpd
#!/usr/bin/env ruby
# encoding: UTF-8
'di '
'ig00 '
# VSFTPD auto-MD5 program
#
# Run man -l <this file> for documentation
require 'rb-inotify'
@lpar
lpar / jay
Created June 20, 2011 17:13
jay - a utility for removing excess kernel files from Ubuntu systems
#!/usr/bin/env ruby
# encoding: UTF-8
'di '
'ig00 '
# This is both a Ruby script and a man page; you can symlink it into your
# man directory as /usr/local/man/man8/jay.1 or run man -l on this file.
# The package which contains the kernel image itself
KERNEL_PACKAGE = 'linux-image'
@lpar
lpar / Stopwatch.java
Created July 26, 2011 19:55
Stopwatch: Record real time taken for an operation, across multiple runs
import java.text.DecimalFormat;
/**
* The Stopwatch class provides a simple way to record the real-world time taken by an operation,
* averaged over multiple runs, and report the result easily in logs.
*
* An example use case would be timing JDBC calls to a relational database.
*
* This code does not measure CPU time or pay any attention to whether a thread or process is
* active or not. For that, you need to use a profiler.
@lpar
lpar / gist:1320801
Created October 27, 2011 20:42
Generic skeleton template for a command line utility written in Ruby
#!/usr/bin/env ruby
# encoding: UTF-8
'di '
'ig00 '
# This is both a Ruby script and a man page; you can symlink it into your
# man directory as commandname.1 or run man -l on this file.
# This is a generic skeleton for a Ruby command-line utility, showing how to
# make the same file work as both a Ruby script and a man page, for ease of
# distribution. This cool hack brought to you by mathew <meta@pobox.com>.
@lpar
lpar / SubClass.java
Created November 15, 2011 21:58
Java field initialization weirdness with primitive values
public class SubClass extends SuperClass {
protected int myValue = 69;
public SubClass() {
// You might think that field initialization will have been performed before this constructor is executed.
super();
// However, Java doesn't actually perform all the field initialization for this object until this point in the code.
// Note also that there's nothing in the source code to say that initialization happens here.
System.out.println("Subclass constructor continuing");
@lpar
lpar / index.html
Created January 19, 2012 17:51
Simple JavaScript slideshow - no frameworks, no CSS3, no Flash
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Slideshow demo</title>
<script type="text/javascript" src="slideshow.js"></script>
<style type="text/css">
#current { position: absolute; left: 0px; top: 0px; z-index: 0; }
#next { position: absolute; left: 640px; top: 0px; z-index: 1; }
#slideshow { position: relative; border: solid #2b2b2b 3px; overflow: hidden; }
</style>