Skip to content

Instantly share code, notes, and snippets.

lpar /
Created November 14, 2017 19:05
Fish shell script to run ssh-agent correctly, i.e. only start a new one when necessary
# Fish script to run ssh-agent correctly, i.e. only start a new one when
# necessary. Drop it into ~/.config/fish/conf.d and forget about it.
# Uses ps and kill, everything else is done inside fish.
# Requires fish 2.3 for the string manipulation.
# Works with Fedora 26 and CentOS 7, for CentOS 6 you'll need a third party
lpar /
Last active July 22, 2019 16:24

Keybase proof

I hereby claim:

  • I am lpar on github.
  • I am meta23 ( on keybase.
  • I have a public key ASA7PxMoCOU9rSoehhs8ukKvGYk1ioM4GLQ-OTQslBIV3wo

To claim this, I am signing this object:

lpar /
Last active January 29, 2023 14:09
How to make Hugo (0.20+) generate an Atom feed instead of RSS

The Hugo static site generator sadly still uses the obsolete and badly standardized RSS format.

Here's how to set it up to generate an Atom feed instead. Pretty much all feed readers which understand RSS also understand Atom, except iTunes, and Atom is a better format.

  1. Define an appropriate media type and corresponding output format in config.toml:
lpar / combos
Last active July 13, 2016 14:17
Go programming exercise: generating all combinations of an alphabet of symbols
View combos
lpar / reflection.go
Created April 20, 2016 18:08
A detailed example of reflection in Go, interrogating and modifying field values in a struct
View reflection.go
package main
import (
// A detailed example of examining a struct value in Go via reflection,
// and changing field values (if possible).
View Clean up download files.applescript
-- This is the script piece of an Automator workflow, it won't work without the rest of the workflow.
on run {input, parameters}
set maxDaysOld to 14 -- This is the number of days of stuff to keep
set oldFiles to {}
set oldFilesRef to a reference to oldFiles
repeat with n from 1 to length of input
set thing to item n of input
set dateAddedString to (do shell script "mdls -name kMDItemDateAdded -raw " & quoted form of POSIX path of thing)
set dateadded to the (date dateAddedString)
set daysold to ((current date) - dateadded) / 86400
lpar /
Created January 5, 2016 22:55
Domino XPages directory name picker using standard Directory API, compatible with Directory Assistance Raw
* © Copyright IBM Corp. 2016
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
* Unless required by applicable law or agreed to in writing, software
lpar / bom.c
Created December 1, 2015 23:08
Somebody set us up the BOM!
View bom.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
FILE *ifp, *ofp;
ofp = fopen("test.txt", "wb");
lpar / java-install
Last active October 29, 2015 14:39
Set up Java on Linux
View java-install
#!/usr/bin/env ruby
# encoding: UTF-8
# Programs to install from the Java runtimes
PROGS = ['java', 'javac', 'javaws', 'jar', 'keytool']
# Plugins for browsers, original lib name then the name to use in the
# alternatives system
'' => ''
lpar / 10-mail.conf
Created May 15, 2015 14:13
Main Dovecot configuration file /etc/dovecot/conf.d/10-mail.conf
View 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)