Skip to content

Instantly share code, notes, and snippets.

View hynek's full-sized avatar
🎯
squeezed between dealing post-travel & pre-travel; pls be patient

Hynek Schlawack hynek

🎯
squeezed between dealing post-travel & pre-travel; pls be patient
View GitHub Profile
mktmpenv
New python executable in /Users/hynek/.virtualenvs/6a3208995e966073/bin/python
Installing setuptools, pip...done.
«6a3208995e966073» ~
↪︎ pip install cryptography
DEPRECATION: --no-install, --no-download, --build, and --no-clean are deprecated. See https://github.com/pypa/pip/issues/906.
Downloading/unpacking cryptography
Using download cache from /Users/hynek/.pip/cache/https%3A%2F%2Fpypi.vm.ag%2Froot%2Fpypi%2F%2Bf%2Ff002a442c8c5c7463bf8d2f11f6c3128%2Fcryptography-0.2.2.tar.gz
Running setup.py (path:/Users/hynek/.virtualenvs/6a3208995e966073/build/cryptography/setup.py) egg_info for package cryptography
no previously-included directories found matching 'documentation/_build'
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
owGbwMvMwMG4TtVMqT7zYyPj6QNPkhiCJbv8qpWS8lMqlayqlbJTwVRaZl56alFB
UWZeiZKVUrJRooFJmoVZYnKqkUViSnKahaF5SlKSeWKqkamxmZGReZqZZZqhhaGS
jlJGfjFIB9CYpMTiVL3MfKAYkBOfmQIUdXSFqnczs3SDqC8FS6QlJxqZGaeamZuY
mySlGZonpqQaWZolmyWbmhkmphgYgBQWpxblJeamAlVnVOalZivV6igBhcoyk1NB
DoZKpWeWZJQm4VBeUlkA4penJsVDdcYnZealAL0K1FCWWlScmZ+nZGUIVJlckgnS
amhsaWJoYWRubKyjlFpRkFmUGp8JUmFqbmZhAAQ6SgVFqWWgAEqxTEyxSDFPTDOw
SDM3TDROM00zTjYzs0hOSzNIMTQzskhJM0tLTDY0NzJKTjYyszBJSkkzMTA2MEpJ
@hynek
hynek / gist:1266898
Created October 6, 2011 09:01
A decorator for Django tests that logs you in before running a test.
def login_first(test):
"""Decorator offering convenience login for tests that require it."""
def _login(self):
self.client.login(
username='testusername',
password='testpassword')
return test(self)
return _login
@hynek
hynek / gist:2965846
Created June 21, 2012 13:51
Match indentation of second argument with first argument if the first one on the same line like the opening parenthesis - originally by Steve Losh
--- /Users/hynek/Downloads/python.vim 2012-06-21 15:44:18.000000000 +0200
+++ python.vim 2012-06-21 15:38:52.000000000 +0200
@@ -119,11 +119,7 @@
return indent(parlnum) + &shiftwidth
endif
else
- if closing_paren
- return parcol - 1
- else
- return parcol
from OpenSSL import SSL
from twisted.internet import ssl
class TLSContextWithChainFileFactory(ssl.DefaultOpenSSLContextFactory):
"""
A SSLContext factory for TLS only and C{certificateFileName} is set as the
chain file. Add all chain files that lead from the CA to your certificate.
"""
def cacheContext(self):
@hynek
hynek / l.py
Created April 25, 2013 21:45 — forked from dstufft/l.py
def foo():
"""
... Doc string goes here
"""
pass
>>> def f(x,*,y,z):
... print(x, y, z)
...
>>> f(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() takes 1 positional argument but 3 were given
class Foo:
_answer = 42
@property
def answer(self):
print('getting!')
return self._answer
@answer.setter
def answer(self, new_answer):
print('setting!')
$ ffind '*anypattern*'
Traceback (most recent call last):
File "/usr/local/bin/ffind", line 843, in <module>
main()
File "/usr/local/bin/ffind", line 819, in main
if options.literal or not is_re(query):
File "/usr/local/bin/ffind", line 702, in is_re
return not all(c.lower() in string.letters + '_-' for c in s)
File "/usr/local/bin/ffind", line 702, in <genexpr>
return not all(c.lower() in string.letters + '_-' for c in s)
@hynek
hynek / gist:6972160
Last active December 25, 2015 11:49
A Marked 2 custom processor that renders reST files with rst2html and leaves the rest be.
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import subprocess
ext = os.environ['MARKED_EXT'].lower()