Skip to content

Instantly share code, notes, and snippets.

@jcgruenhage
jcgruenhage / hedgedoc-url-decode-uuid.rs
Created July 13, 2023 09:29
Small rust script for decoding the ID from a hedgedoc URL path to the uuid used in the database.
#!/usr/bin/env cargo
//! ```cargo
//! [dependencies]
//! anyhow = "1"
//! base64 = "0.21"
//! hex = "0.4"
//! ```
use base64::Engine;
@jcgruenhage
jcgruenhage / certificate-metrics-textfile.py
Created April 7, 2023 11:48
node_exporter compatible textfile generator for certificate expiry
#!/usr/bin/python3
from pathlib import Path
from cryptography import x509
import time
textfile = open('/path/to/metrics', 'w')
textfile.write('# HELP ssl_certificate_expiry Unix timestamp of certificate expiry\n')
textfile.write('# TYPE ssl_certificate_expiry gauge\n')
/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj5RIq7/5dADgYS3Zs2QpOuJqzz6GzBKslePyepc2iB6gh
axGgoHvhRRjG2PA+fbb23uuZ1d+Zi8oDlbZT1F3ODLcLElHHOYLy2CXVmLydbXmfhd9ZaE74yXWq
BNiffIf1gxf5MV3INDkQFIWMPyVaeuDWZsxp54qoTr59U686dHJgX8CfBgm+/aU5o0B/ps9Gxh/1
fGvGAOnWb2yTv5/lw8r+PnBMKvbqVS/H8vZENg9E1w+bAPaRf8O2BKwMw7tsQsRj+MujxkQW0Fl9
KgAXHMk/qI6OX1pL4IxXkFj7RCbIj+YZg/cO8ShEbHp0Y727lizkDiILN9mqWJG+3oxFuxG34nZv
7uGu8+uWqnQVhgdzvWOiMu+sqnhpLIUb40XSnWIDG0+V30KDdFn7w8iiHT2wgSuTaJsVKzddkOcK
RzKyQmzXamf7CAz5e0R9n/KXi2xd2E7irzG8OTK20jvgPSj6obFDPtLX/XTIScCODdAikLfj9h0i
QJaQ5NfQlT7fvF+s2vstOwAM4sx63eMVE48jsxcV1dk9B8CRChUcWl8Y7NFg6y6DQcCMGbdfucxS
bBzcwZDBsXYjtktCd7al0UYYjyKBSctvZ+6RZQeOXHgsX41WeCkDpnHgW3QyHiKMGnqFmycLNIUV
HhR7K9ryCx3hGHz2GI5HhM7onjvvlQQjNqbGSfY/0WWEMlMqOSJhttrfyrPBH+7/vPZ2bKYWiY+V
#!/usr/bin/env python3
import signal
import time
import sys
def sigterm_handler(a, b):
print("Hello World!")
sys.exit()
@jcgruenhage
jcgruenhage / DocumentsStorageProvider.java
Created November 19, 2016 14:43
DocumentsProvider with Subtree selection. Read only. Not sure if writing in the subtree would work just by implementing writing in general.
/**
* nextCloud Android client application
*
* @author Bartosz Przybylski
* Copyright (C) 2016 Bartosz Przybylski <bart.p.pl@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*