Skip to content

Instantly share code, notes, and snippets.

@msabramo
msabramo / pyclean.sh
Created February 5, 2015 19:26
pyclean
pyclean () {
noglob find . \( -name '*.pyc' -or -name '__pycache__' \) -exec rm -rf {} +
}
@msabramo
msabramo / http.json
Created January 8, 2015 16:24
JSON grammar for parsing HTTP requests and responses to syntax highlight them (for Atom, GitHub, etc.)
{
"scopeName": "text.http",
"name": "HTTP",
"fileTypes": [
"http"
],
"patterns": [
{
"match": "^([A-Z]+) (/apps) (HTTP/1.1)$",
"comment": "E.g.: GET /path/to/page HTTP/1.1",
@msabramo
msabramo / pip_refactor.patch
Created December 17, 2014 21:32
Big pip refactoring to move path_to_url and url_to_path to pip/utils.py
diff --git a/pip/cmdoptions.py b/pip/cmdoptions.py
index a4ef0b7..7b17604 100644
--- a/pip/cmdoptions.py
+++ b/pip/cmdoptions.py
@@ -11,8 +11,8 @@ from __future__ import absolute_import
import copy
from optparse import OptionGroup, SUPPRESS_HELP, Option
-from pip.index import PyPI
from pip.locations import CA_BUNDLE_PATH, USER_CACHE_DIR, src_prefix
@msabramo
msabramo / gist:b3a12a570e49fd1a1858
Created December 17, 2014 16:27
virtualenv error creating py3 env
❯ virtualenv --python python3.3 py33
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 41, in <module>
import ConfigParser
ImportError: No module named 'ConfigParser'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
@msabramo
msabramo / gist:6a321caa5e21e3ec03f8
Created December 17, 2014 16:23
virtualenv error Python 3
❯ /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -mvirtualenv --setuptools --python /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 py33
Running virtualenv with interpreter /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenv.py", line 41, in <module>
import ConfigParser
ImportError: No module named 'ConfigParser'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
@msabramo
msabramo / gist:b2f73bb72e4a4c2cab73
Created December 17, 2014 16:16
tox error with Python 3
[marca@marca-mac2 readme]$ tox -r -e py33
GLOB sdist-make: /Users/marca/dev/git-repos/readme/setup.py
py33 create: /Users/marca/dev/git-repos/readme/.tox/py33
ERROR: invocation failed (exit code 1), logfile: /Users/marca/dev/git-repos/readme/.tox/py33/log/py33-0.log
ERROR: actionid=py33
msg=getenv
cmdargs=['/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python', '-mvirtualenv', '--setuptools', '--python', '/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3', 'py33']
env={'GOPATH': '/Users/marca/go', 'VIRTUAL_ENV_DISABLE_PROMPT': '1', 'LESS_TERMCAP_md': '\x1b[01;31m', 'HOMEBREW_CASK_OPTS': '--appdir=/Applications', 'rvm_niceness': '', 'LESS': '-F -g -i -M -R -S -w -X -z-4', 'rvm_gemstone_package_file': '', 'rvm_path': '/Users/marca/.rvm', 'LESSOPEN': '| /usr/bin/env lesspipe.sh %s 2>&-', 'TMPDIR': '/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/', 'RUBY_VERSION': 'ruby-2.1.2', 'DOCKER_HOST': 'tcp://172.16.42.43:4243', 'LOGNAME': 'marca', 'USER': 'marca', 'r
exporting patches:
# HG changeset patch
# User Marc Abramowitz <marc@marc-abramowitz.com>
# Date 1418102744 28800
# Branch markdown-readme-1
# Node ID 1b4f37c1b9f6839c4c835cbe1a38f2017fa014ec
# Parent 58c3f40321becbbcb3ac2b28cd4995931bf2a332
Add tests for markdown rendering
diff --git a/tests/test_description_utils_markdown.py b/tests/test_description_utils_markdown.py
@msabramo
msabramo / gist:5e82d78ad9687ddf2cbc
Last active August 29, 2015 14:10
ansible python 2.6 test failures
❯ tox
GLOB sdist-make: /Users/marca/dev/git-repos/ansible/setup.py
py26 recreate: /Users/marca/dev/git-repos/ansible/.tox/py26
py26 installdeps: Jinja2, mock, nose, passlib, PyCrypto, PyYAML, unittest2
py26 inst: /Users/marca/dev/git-repos/ansible/.tox/dist/ansible-1.9.zip
py26 runtests: PYTHONHASHSEED='587768245'
py26 runtests: commands[0] | nosetests -d -w test/units
..............................................................................................E......................................................................................E...............................................
======================================================================
ERROR: test.units.TestModuleUtilsDatabase.TestQuotePgIdentifier.test_how_many_dots
@msabramo
msabramo / logit.py
Created November 25, 2014 07:26
VarLogger class that can log both variable name and value
import ast
import inspect
import logging
import sys
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@msabramo
msabramo / tsuru-setup.sh
Created November 12, 2014 05:56
Script to automate a lot of the setup of tsuru
PROG="tsuru-setup"
if [ -z "${TSURU_USER}" ]; then
echo "${PROG}: Please set the TSURU_USER environment variable before running this script"
exit 1
fi
if [ -z "${TSURU_TARGET}" ]; then
echo "${PROG}: Please set the TSURU_TARGET environment variable before running this script"
exit 2