Skip to content

Instantly share code, notes, and snippets.

View jsha's full-sized avatar
🌰

Jacob Hoffman-Andrews jsha

🌰
View GitHub Profile
# mail.example.com should be one of the results of a `dig +short mx example.com`
# Note that your provider might block all port 25.
# If STARTTLS header is missing or mangled, but https://starttls.info/ shows example.com as supporting STARTTLS,
# there might be a downgrade going on.
(echo EHLO foo ; sleep 3) | nc mail.example.com 25
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/handlers.py", line 76, in emit
if self.shouldRollover(record):
File "/usr/lib/python2.7/logging/handlers.py", line 154, in shouldRollover
self.stream = self._open()
File "/usr/lib/python2.7/logging/__init__.py", line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 2] No such file or directory: '/tmp/tmpqMQlpx/logs/letsencrypt.log'
[30346:0x2950a00] 35606383 ms: Scavenge 1500.2 (1610.1) -> 1485.7 (1610.1) MB, 84.0 / 2.8 ms allocation failure
[30346:0x2950a00] 35607128 ms: Scavenge 1502.4 (1610.1) -> 1490.5 (1610.1) MB, 188.9 / 3.1 ms allocation failure
[30346:0x2950a00] 35607844 ms: Scavenge 1503.8 (1610.1) -> 1494.3 (1610.1) MB, 198.0 / 3.1 ms allocation failure
[30346:0x2950a00] 35608383 ms: Scavenge 1509.1 (1610.1) -> 1501.0 (1610.1) MB, 205.4 / 3.0 ms allocation failure
[30346:0x2950a00] 35608811 ms: Scavenge 1511.8 (1610.1) -> 1503.8 (1612.1) MB, 212.4 / 11.7 ms allocation failure
[30346:0x2950a00] 35609152 ms: Scavenge 1516.9 (1612.1) -> 1505.1 (1614.6) MB, 188.9 / 11.4 ms allocation failure
[30346:0x2950a00] 35609516 ms: Scavenge 1519.4 (1614.6) -> 1506.9 (1616.1) MB, 206.5 / 26.6 ms allocation failure
[30346:0x2950a00] 35615217 ms: Mark-sweep 1520.8 (1616.1) -> 1484.7 (1609.3) MB, 5536.9 / 26.8 ms allocation failure scavenge might not succeed
[30346:0x2950a00] 35616097 ms: Scavenge 1499.5 (1609.3) -> 1485.3 (1609.
DOMAIN=com.example # pre-sanitized
POLICY_FILE=policy-files/$DOMAIN.json
git pull
# retrieve all tags on commits that changed $POLICY_FILE
# (with the additional constraint that at least one of the tags on each commit should be
# named like example.com.2014.06.01.serial)
# the git log output looks like: (tag: tagname1, tag: tagname2, headname1, headname2)
TAGS=`git log --pretty=%d | egrep -o "[( ]tag: $DOMAIN[0-9\.]+" | cut -d":" -f 2`
for TAG in $TAGS ; do
@jsha
jsha / gist:8bcbdc53620308968a43738e62bd7dd8
Last active January 16, 2017 18:14
letsencrypt logs from certbot on jessie
# ls /var/log/letsencrypt/ -ltr
total 104
-rw-r--r-- 1 root root 0 Jan 14 00:51 letsencrypt.log.13
-rw-r--r-- 1 root root 2322 Jan 14 00:51 letsencrypt.log.12
-rw-r--r-- 1 root root 756 Jan 14 00:51 letsencrypt.log.11
-rw-r--r-- 1 root root 779 Jan 14 00:52 letsencrypt.log.10
-rw-r--r-- 1 root root 873 Jan 14 00:52 letsencrypt.log.9
-rw-r--r-- 1 root root 795 Jan 14 00:52 letsencrypt.log.8
-rw-r--r-- 1 root root 2345 Jan 14 00:52 letsencrypt.log.7
-rw-r--r-- 1 root root 2345 Jan 14 00:52 letsencrypt.log.6
package main
import (
"bufio"
"flag"
"fmt"
"net/http"
"os"
"sync"
)
# ~/.screenrc
# Jacob Hoffman-Andrews
# 1998-08-10
# ensure bash is started rather than what's in /etc/passwd
shell -bash
# use fun messages
nethack on
-----BEGIN CERTIFICATE-----
MIIDDTCCAfWgAwIBAgIJAOcb3mHCoKrJMA0GCSqGSIb3DQEBCwUAMCQxIjAgBgNV
BAMMGWN5YmVyIGN5YmVyIGN5YmVyIGZha2UgQ0EwHhcNMTYwMzAyMDY1OTU1WhcN
MjEwMzAxMDY1OTU1WjAkMSIwIAYDVQQDDBljeWJlciBjeWJlciBjeWJlciBmYWtl
IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4A08e059jeIEt24g
xweZGZ4R4hL2Ut4XK2icjG5UXaqfrvplprPrFZ53dsw1+xNUG9eXhAeeBTdn6v6B
59UrGqhFmXGCWTIQr4/smYZ3zlOwl/9/4wXfVgOIlbOj0r9nIsvE/tU6rd+A5J9K
gs2+7qO2xZpDJiSAZa2GZB9ssJHT7RwsdUgMw1bVCjkBHZfOVfcO5908JsH533fY
F1kM8t5TPccMaVRBlhaWUJUG6F0KKNN09Zl6RtsQh6ZCtuxvgLJ3AtX9VmfP4m5z
ybLjdSzyKUWZHGbed7PeCs7mjI11VQQSvIcveOuWiW+mRW2DK3A334dR8FJanr8f
@jsha
jsha / mysql-count-value.py
Last active January 31, 2016 23:13
Python script to count occurrences of a field value in MySQL
#!/usr/bin/env python
#
# Using MySQL's grouping and counting features for very large tables is
# very slow. This Python script makes it much faster to count unique
# values of a given column. It selects the column values in reasonably-sized
# chunks (10k rows), and feeds those values into a collections.Counter.
#
# Assumptions: you have a .my.cnf set up to connect to the right DB with the
# right username and password. Your table has an id field, which is numeric and
# ideally autoincrement (for smooth distribution of values).
2015/09/08 19:46:18 [s<][SA.server][RA->SA.testing-worker-linux-docker-79d0ac90-3204-linux-3] received UpdatePendingAuthorization(eyJpZCI6InpQTk9uT2NMNWk1N0FhRzZjOHYxaFdwTmF6cWt2OWJPUGJwbGxiZTBVelkiLCJpZGVudGlmaWVyIjp7InR5cGUiOiJkbnMiLCJ2YWx1ZSI6ImxlLnd0ZiJ9LCJyZWdJZCI6Miwic3RhdHVzIjoicGVuZGluZyIsImNoYWxsZW5nZXMiOlt7InR5cGUiOiJzaW1wbGVIdHRwIiwic3RhdHVzIjoicGVuZGluZyIsInVyaSI6Imh0dHA6Ly9sb2NhbGhvc3Q6NDAwMC9hY21lL2F1dGh6L3pQTk9uT2NMNWk1N0FhRzZjOHYxaFdwTmF6cWt2OWJPUGJwbGxiZTBVelk_Y2hhbGxlbmdlPTAiLCJ0b2tlbiI6Ikh5anQySVRpMGlaYXhwY2g5eVJFbWxFamp0Mk5fN2RDaUVlWk9Iem1wTEEiLCJ0bHMiOnRydWUsImFjY291bnRLZXkiOnsia3R5IjoiUlNBIiwibiI6Im1rdGZpNHNaMTdLeFVTX2JtU0hPendZRFVyc20yOUl3d1VBVmxvN2I3VUZtaUlDbGVaNFphTW5YM0FKYTRvbnhxY0lMbkZReFVpMkh6TG1RUHNYT1QyamdMcXNQUko1UnNQNGlMY1ZHMFpTdVhkc3hKVTRzVWpRdWFqSmR3RUUwa0pCVENBYzV5U2ItYXNwYTNRTV9yUU9FZDZ5MmR6dnFyc25MNmZpeXhWWlMwdDR4MlNGMUoxbW5Sc2lLaW5FQlBwNWxUTXpRVHkzYlRRVVFwclI4djE5emlVQWx5WlpoTWlrVTM3VGdXLUVMMkVKcEZfSTVsOWtIakNQVzB3aUVCUHU4eFBBa2tjN3U3TE5JMGQxZjluX21USVJJbjZaRERZeFotRzFyN