Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / REST.xsp
Last active July 21, 2023 20:16
Minimal example of a 4-verb REST service in IBM Domino XPages, with no external dependencies.
<?xml version="1.0" encoding="UTF-8"?>
<!-- XPages source for REST service. -->
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false">
<xp:this.afterRenderResponse><![CDATA[#{javascript:
com.ath0.xrest.Service.dispatch();
}]]></xp:this.afterRenderResponse>
</xp:view>
@lpar
lpar / logreport.rb
Created June 7, 2013 19:04
Report the first 10 lines of all files on the command line, transparently decompressing .xz compressed files.
#!/usr/bin/ruby
# encoding: UTF-8
# The audit team wanted to know that we were doing logging as required. As
# evidence, they asked for a regular report consisting of the first 10 lines
# of each daily log file. I wrote this script to automate the process.
# If you want the last 10 lines instead, I suggest the Ruby Gem called Elif,
# which wraps any IO object to read line by line backwards.
LINES_OF_LOG = 10
@lpar
lpar / ldapauth.rb
Created June 7, 2013 14:53
Example of LDAP authentication in Ruby. Written for IBM Intranet, but should easily be adaptable to other environments.
#!/usr/bin/ruby
# An example of BluePages / IBM Intranet Password authentication using Ruby.
# Uses the gem ruby-ldap, a Ruby wrapper for OpenLDAP. Works with Ruby 2.0.
#
# To get this code to work, you must
#
# 1. gem install ruby-ldap
# 2. add
#
@lpar
lpar / reader2evernote.rb
Created March 14, 2013 20:35
Google Reader to Evernote. Quick hack together of a Ruby script which will pull all your Google Reader starred items into an Evernote notebook in ENML (Evernote export format).
#!/usr/bin/env ruby
# encoding: UTF-8
# Google Reader to Evernote
# Quick hack together of a Ruby script which will pull all your Google Reader
# starred items into an Evernote notebook in ENML (Evernote export format).
# Requires Ruby 2.0, no other special dependencies. Should work on 1.9 but I
# haven't tested it.
#
@lpar
lpar / flac2mp3.rb
Created January 26, 2013 22:58
Ruby script I use to convert FLAC files to MP3, and then copy the metadata across.
#!/usr/bin/env ruby
# encoding: UTF-8
# Convert FLAC files to mp3 files, keeping metadata from the FLAC files.
#
# Requires that FLAC (including metaflac) and LAME tools be installed
# and on the path.
#
# Takes any number of .flac files on the command line.
@lpar
lpar / example.rb
Created March 23, 2012 22:56
Brief demonstration of using character encodings in Ruby 1.9
#!/usr/bin/env ruby
# encoding: UTF-8
# Notice I set UTF-8 as the default above. As far as I'm concerned there
# are two choices of encoding: UTF-8, and legacy crap. If I need to deal
# with anything else I'll handle it explicitly, as in this example.
# Open an ISO-8859-1 file.
infile = File.open("iso88591.txt", "r:iso-8859-1")