Skip to content

Instantly share code, notes, and snippets.

View lvh's full-sized avatar

lvh lvh

View GitHub Profile
@lvh
lvh / cached_protocol.clj
Last active August 28, 2022 01:54
An automatic cached protocol impl I wrote but didn't end up using.
;; (:import
;; (java.nio.file Path FileSystems StandardWatchEventKinds))
(def ^:private all-events
(object-array
[StandardWatchEventKinds/ENTRY_CREATE
StandardWatchEventKinds/ENTRY_DELETE
StandardWatchEventKinds/ENTRY_MODIFY]))
(defn ^:private watch!
@lvh
lvh / _about.md
Last active March 22, 2017 20:32
How the generate a random password or security question

https://imgs.xkcd.com/comics/password_strength.png

This is a generator for random passwords. It is also useful as the answer to security questions.

How this works

  1. Install gshuf. It's in GNU coreutils. On Macs with homewbrew, brew install coreutils. (On Linux, it night be called just shuf.)
  2. ./get-some.sh

What are these words?

@lvh
lvh / keybase.md
Created February 20, 2015 19:14
Keybase key cycling notice

Keybase proof

I hereby claim:

  • I am lvh on github.
  • I am lvh (https://keybase.io/lvh) on keybase.
  • I have a public key whose fingerprint is 45DC 13EB 6A01 21E8 5219 8C09 8763 869B E2B2 663E

To claim this, I am signing this object:

@lvh
lvh / gist:6adfe51aa42bb268a273
Created February 20, 2015 19:03
Key cycling notice
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I am cycling my GPG key.
My old key has fingerprint:
D9DC 4315 772F 8E91 DD22 B153 DFD1 3DF7 A8DD 569B
My new key has fingerprint:
@lvh
lvh / cobyla.ipynb
Created April 8, 2014 10:29
PyCon financial aid grant optimization with COBYLA
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lvh
lvh / keybase.md
Created March 7, 2014 14:35
Keybase verification

Keybase proof

I hereby claim:

  • I am lvh on github.
  • I am lvh (https://keybase.io/lvh) on keybase.
  • I have a public key whose fingerprint is D9DC 4315 772F 8E91 DD22 B153 DFD1 3DF7 A8DD 569B

To claim this, I am signing this object:

@lvh
lvh / info.txt
Created March 7, 2014 14:02
A notification of my cycled key.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
My old PGP key (8D2E6BACE6D6AAAE) is being replaced by my new key
(DFD13DF7A8DD569B). You can find the new one on key servers near you.
The new key has been signed with the old one. The old key is now (by
time of reading, not writing) revoked. I have no reason to believe
that my old key was compromised.
I have updated my key on PyPI.
from json import dumps, loads
from twisted.internet.defer import inlineCallbacks
from twisted.protocols.basic import NetstringReceiver
from twisted.python import log
class JSONRPCReceiver(NetstringReceiver):
def stringReceived(self, string):
try:
request = loads(string)
@lvh
lvh / release-procedure.txt
Last active December 19, 2015 18:29
Updated release procedure for Divmod
1. Check Jenkins builders.
2. Get the latest revision:
% bzr pull
3. Bump version number in <Package>/<package>/_version.py
4. Write release notes in <Package>/NEWS.txt. Add version number and date.
def _immediateResponder(f):
"""
A decorator for responder functions that should return immediately and
execute asynchronously, as a defense against timing attacks.
The responder decorator should be applied after (above) this decorator::
@SomeCommand.responder
@_immediateResponder
def responder(...):