Skip to content

Instantly share code, notes, and snippets.

@yrro
yrro / zzz_letsencrypt
Created July 4, 2016 15:49
certbot (letsencrypt) cron job
#!/bin/bash
set -eux
mapfile domains <<- EOF
example.com,www.example.com apache2
example.net apache2
imap.example.com dovecot
smtp.example.com exim4
mumble.example.com mumble-server
#!/usr/bin/python3
import subprocess
import sys
import tempfile
def main():
kw = 'answered-learned-ham'
max_size = 2*2**20
@yrro
yrro / java-sd_notify.java
Last active February 5, 2024 09:39
The poor Java programmer's alternative to calling sd_notify
/*
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
/*
Run with:
groovy
-cp '/etc/hadoop/conf:/usr/lib/hadoop/*:/usr/lib/hadoop/lib/*'
hdfs-site.xml
yarn-site.xml
mapred-site.xml
/vagrant/config.groovy
*/
case $(locale charmap) in
UTF-8)
_smile_happy='☺'
_smile_frown='☹'
;;
*)
_smile_happy=':)'
_smile_frown=':('
;;
esac
@yrro
yrro / electrum mnemonic example
Created October 8, 2013 14:53
Generating a 256-bit passphrase with Electrum
$ x=$(od -v -t x1 -A n -N $((256/8)) < /dev/urandom | tr -d '[:space:]')
$ echo $x
807ee2385fb310491e126f248f66fded432d438b1a00133cf00456e85e59f04a
$ python mnemonic.py $x
aside enough match affection fill conversation replace toe mud forget enough bloom gently sunlight out relationship gentle lovely claw dot illuminate marry king grant
$ python mnemonic.py aside enough match affection fill conversation replace toe mud forget enough bloom gently sunlight out relationship gentle lovely claw dot illuminate marry king grant
807ee2385fb310491e126f248f66fded432d438b1a00133cf00456e85e59f04a