Skip to content

Instantly share code, notes, and snippets.

View erikrose's full-sized avatar

Erik Rose erikrose

View GitHub Profile
#!/usr/bin/env python
"""BBEdit UNIX filter that wraps one or more optionally-indented,
hash-commented lines to 79 chars, preserving indentation.
Just select all the lines (in their entirety) the comment spans, and invoke.
Works with #, --, and //-style comments.
For example, this... ::
# Upping this to 10000 makes it 3x faster. 10000 takes 15.936s. 5000 takes 16.303s.
#!/usr/bin/env python
# How the corpus was built:
# 1. Start with the Belfry WebComics Index: http://new.belfrycomics.net/view/all. (Choose "All Comics" and "Daily" as filters.) Spider down all those linked pages.
# 2. Throw out the few (about 5) pages that are clearly not single comics. Doing this early makes it likely our training and test sets will still be close to 70/30.
# 3. Use this to divide into a training set (for optimizing weights and getting best-case performance) and a testing set (for seeing how we did on unseen data). We use a 70/30 split only because it is a common rule of thumb. Since I'm writing features by hand, I start with a small subset of the training set (30 comics) and validate on another small subset. If the validation goes poorly, we induct that validation set into the training set, look for patterns of error in it, and adjust the features to eliminate them. Then we validate against a new subset, and so on. Hopefully, we start to do okay before we run out of data. The test set is f
Type uWSGI, press enter: good stuff about uWSGI's blocking and restarting behavior
The GILectomy: entertaining low-level twiddling and benchmarks
Snek in the Browser: a novel approach to Python in the browser, with only a few hundred K overhead
Constructive Code Review, if you like to watch me prance around. Polished up a lot since the Mozilla onboarding version.
"When the abyss gazes back" should be great; I have yet to watch it
Modern Python Dictionaries is full of clever ideas
Static Types for Python goes over a little of how type inference works
The Fastest Fizzbuzz is a walkthrough of writing a JITing compiler based on PyPy infra
The Dictionary Even Mightier: more dict internals. Brandon Rhodes is always entertaining.

In preparation for the release of version 0.4.0 of the python client, we are transitioning to a new version of the letsencrypt-auto script. As most of you know, letsencrypt-auto is available as an alternative for OS packaging, on those operating systems that do not yet have backported packages. The new version of the script includes a number of important improvements:

  • A reproducible set of python package dependencies, enforced by version pinning and hash verification. (Previously, we trusted an HTTPS connection to PyPI for authenticity.)
  • The script now updates itself as well as the underlying python client. If you don't want this behavior, you can turn it off with --no-self-upgrade.
  • A git clone operation is no longer required; you can now download the script as a single file and run it.
  • Much faster execution, especially on the second and subsequent times it is run, and especially on slo
- [ ] Rising standards of repeatability:
- [ ] pip freeze
- [ ] This gives you the basics, defending you against buggy or
incompatible upstream updates.
- [ ] Be sure to include dependencies! Install with --no-deps
and run your test suite to make sure it works.
- [ ] hashes
- [ ] This defends you against package replacement (which PyPI
doesn't allow anymore but other indexes might), indexes
getting hacked, and MITM attacks. (HTTPS also contributes
if is_yak then
shave yak
bathe yak
else
do productive_work
--> (if is_yak then
((shave yak)
(bathe yak))
else
@erikrose
erikrose / gist:74dd8d83e52cfe18edef
Last active August 29, 2015 14:22
Histograms Of Furthest States Reached By Hello Link-Clickers In Trysts
Of rooms in which there were ever 2 people simultaneously, here are the
furthest states reached by the link-clicker.
We'll have state info for the built-in client starting in v40. "Further"
states are toward the bottom of the histograms. Histograms are out of scale
with each other.
2015-05-01:
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=376668">No password autofill in evidence</a> when &gt;1 account (hung up in cosmetics bikeshedding since 2007) <b>UI</b></p>
<p>Text-editing keystrokes: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420669">command-delete</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=426246">and that again</a> since 2008, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=571913">option-arrowkey</a> since 2010 (3.6), <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=27771">Page Down</a> (since 2000) <b>UI</b></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=306730">"Software security device" dialog</a> (hung up on corner case objections since 2005) <b>UI</b></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=78414">Plugins eat application keyboard shortcuts</a> (173 dupes! since 2001) Can't close windows when Flash focused. (This one is just complicated.) <b>Tech</b></p>
<p>Flash (general UE: keyboard capturing (can't clo
I think the reason open-source projects aren't great at churning out products
(or "finishing" them, as you so astutely word it—in the sense of "polishing")
is that the things that are interesting to work on are orthogonal to the
things that make a good product.
The advantage a hierarchal organization brings to product creation is focus.
It's what I enjoy about Apple: sometimes their products aren't for me, but
they're always *coherent*. I can see what they were going for. The Apple suite
of apps are clearly the best browser, calendar, and mailer for Steve Jobs.