Skip to content

Instantly share code, notes, and snippets.

View erikrose's full-sized avatar

Erik Rose erikrose

View GitHub Profile
@erikrose
erikrose / gist:9233244
Last active August 29, 2015 13:56
Regex parser in Parsimonious
from parsimonious import Grammar # Get Parsimonious from https://pypi.python.org/pypi/parsimonious/.
# This recognizes a subset of Python's regex language, minus lookaround
# assertions, non-greedy quantifiers, and named and other special sorts of
# groups. Lucene doesn't support those, though we might be able to fake it
# later via some transformation.
regex_grammar = Grammar(r"""
regexp = branch another_branch*
branch = piece*
[DXR]
a = 1
b = 2
[some_tree]
source_folder = PWD/code
object_folder = PWD/code
build_command = make clean; make -j $jobs
[another_tree]
def full_traceback(callable, *args, **kwargs):
"""Work around the wretched exception reporting of concurrent.futures.
Futures generally gives no access to the traceback of the task; you get
only a traceback into the guts of futures, plus the description line of
the task's traceback. We jam the full traceback of any exception that
occurs into the message of the exception: disgusting but informative.
"""
try:
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.
<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
@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:
if is_yak then
shave yak
bathe yak
else
do productive_work
--> (if is_yak then
((shave yak)
(bathe yak))
else
@erikrose
erikrose / wrap_comment.py
Last active September 23, 2015 14:27
Comment-wrapping filter for BBEdit 10
"""BBEdit UNIX filter that wraps one or more optionally-indented, 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.
@erikrose
erikrose / gist:1090980
Created July 18, 2011 23:55
Regex to turn Sphinx method and class refs into normal reST, for PyPI display
"""This is how I include a dumbed-down copy of the ordinarily Sphinxified version history in my PyPI README.rst in django-tidings."""
re.sub(r':[a-zA-Z]+:`[0-9a-zA-Z~_\.]+\.([^`]+)`',
r'``\1``',
open('docs/changes.rst').read())
- [ ] 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