Skip to content

Instantly share code, notes, and snippets.

richmilne /
Created March 22, 2024 09:10
In both Python 2 and 3, unambiguously define a sentinel Unicode string (&Ж中𐍆).
# encoding: utf8
Unambiguously define, from hex data, a sentinel Unicode string (&Ж中𐍆).
The string contains a 1-, 2-, 3-and 4-byte Unicode character. Useful for finding
encoding errors in editors and transfer systems!
import sys
py2 = True if sys.version_info.major == 2 else False
richmilne /
Last active March 15, 2024 11:26 — forked from galan/
Import Let's Encrypt certificates into Java's trusted keystore (cacerts)
#!/bin/bash -e
# A codificiation of the steps outlined at
# JAVA_HOME can be passed as argument if not set
if [[ -z ${JAVA_HOME+x} ]] || [[ ! -d ${JAVA_HOME} ]]; then
richmilne /
Last active June 2, 2022 19:47
Approve pull requests on BitBucket Server.
#! /usr/bin/env python3
"""Approve pull requests on BitBucket Server.
If you are trying to approve pull requests on BitBucket from external/3rd-
party tools (like Jenkins) there may be plugins available to do the job
automatically - if you're lucky. The `Bitbucket Approve Plugin`_ seems to be
one such plugin.
Unfortunately, it's only for the *CLOUD*-hosted version of Bitbucket. The
self-hosted version, Bitbucket Server (formerly known as Stash) uses a
richmilne /
Last active October 18, 2020 17:46
Convert your domain's Let's Encrypt certificate (along with their intermediate certs) into a keystore that can be used with Java apps - such as Atlassian's Confluence
#!/usr/bin/env bash
# A codificiation of the steps outlined at
# that I found relevant in getting my LE certs to work with our Confluence install.
# That page, and other sources, suggest that you might also have to import ALL the LE intermediate
# certs into the default Confluence / Java keystore ($JRE_HOME/lib/security/cacerts)
richmilne /
Created October 17, 2015 12:43
Python test cases for first programming assignment in Coursera's "Algorithms: Design and Analysis, Part 1"
Test cases for the 'counting inversions' programming assignment, the first
assignment of the Coursera course "Algorithms: Design and Analysis, Part I".
This module incorporates most of the tests found in the course forum, in
this thread:
To help check my work, I modified my merge_sort implementation to return