Skip to content

Instantly share code, notes, and snippets.

@lpar
lpar / Evernote filing droplet.dmg
Last active Aug 27, 2021
AppleScript droplet to file documents into specific Evernote notebooks
@lpar
lpar / ssh-agent.fish
Created Nov 14, 2017
Fish shell script to run ssh-agent correctly, i.e. only start a new one when necessary
View ssh-agent.fish
#!/usr/bin/fish
#
# 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
lpar / keybase.md
Last active Jul 22, 2019
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am lpar on github.
  • I am meta23 (https://keybase.io/meta23) on keybase.
  • I have a public key ASA7PxMoCOU9rSoehhs8ukKvGYk1ioM4GLQ-OTQslBIV3wo

To claim this, I am signing this object:

@lpar
lpar / README.md
Last active Jul 9, 2022
How to make Hugo (0.20+) generate an Atom feed instead of RSS
View README.md

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
lpar / evernoatse.js
Last active Oct 8, 2016
OS X JavaScript to fix up creation dates of notes in Evernote
View evernoatse.js
// Apple OS X JavaScript (JXA) script for Evernote
// Run using script editor (for example)
// Looks for either a 4-digit year at the start of the note title
// or an ISO-8601 date anywhere in the title
// and sets the note creation date to that date
function run(input, parameters) {
var evernote = Application('Evernote');
var notes = evernote.findNotes();
@lpar
lpar / combos
Last active Jul 13, 2016
Go programming exercise: generating all combinations of an alphabet of symbols
View combos
See https://forum.golangbridge.org/t/generation-of-strings-generation/2968/2
View ShowHide.xsp
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<h1>Imagine this is a form...</h1>
<p>
<xp:button value="Hide submit button" id="hideButton">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[document.getElementById("#{id:submitButton}").style.display = "none";]]></xp:this.script>
</xp:eventHandler>
@lpar
lpar / reflection.go
Created Apr 20, 2016
A detailed example of reflection in Go, interrogating and modifying field values in a struct
View reflection.go
package main
import (
"fmt"
"reflect"
)
// A detailed example of examining a struct value in Go via reflection,
// and changing field values (if possible).
//
@lpar
lpar / config.json
Created Apr 15, 2016 — forked from anonymous/config.json
Bootstrap Customizer Config
View config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "#777677",
"@gray-dark": "#959595",
"@gray": "#aeaeae",
"@gray-light": "#c7c7c7",
"@gray-lighter": "#e0e0e0",
"@brand-primary": "#4178be",
"@brand-success": "#c8f08f",
@lpar
lpar / Gotcha.xsp
Created Feb 18, 2016
XPages gotcha: radio button groups always return isValid() = true, even if they're invalid
View Gotcha.xsp
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument var="document1" />
</xp:this.data>
<h1>XPages validator gotcha</h1>
<p>Radio button groups always return isValid() = true, even if their