Skip to content

Instantly share code, notes, and snippets.


Ionel Cristian Mărieș ionelmc

Block or report user

Report or block ionelmc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View matrix.ini
python_versions =
# syntax:
# alias: dep1 dep2 dep3 !skip_var[glob] &include_var[glob]
ionelmc / .bashrc
Created Jun 10, 2014
SCL python alias (SCL it's a RHEL/CentOS thing).
View .bashrc
sclpython() {
if [ "$#" = 0 ]; then
scl enable python27 python
echo $(
echo python
for i in "$@"; do
printf "%q\n" "$i"
) | scl enable python27 -
View gist:69d11a015445aadcec9a
20:57 <ionelmc> for #1: brittle parsing, could start failing if someone starts adding stuff without knowing what's in
20:58 <ionelmc> for #2: pretty robust, assuming you're always using a separate file
20:58 <qwcode> Ivo might have an opinion on a winner
20:59 <Ivo> what what
20:59 <Ivo> oh god, yeah
20:59 <Ivo> there should be one way to do thihngs
20:59 <Ivo> not 7
20:59 <qwcode> regarding the version section in the PUG offering too many solutions, but no winner
20:59 <ionelmc> for #3: regex could fail later, eg: someone changes from single to double quotes or thinks it's a great idea to create the string with % or .format()
20:59 <Ivo> or 6
View packaging-pitfalls.rst

Forgetting to specify package data.

why:Your package distribution doesn't include static files.
fix:Create a

Listing few file types in, then adding some webfonts - only to find out the release you published on PyPI doesn't include them.

why:You duplicated information you already have in the filesystem. [1]_
fix:Just recursive-include or graft the whole dir.
View git-index.html
<a href="git+">Thing</a>
ionelmc / output.txt
Last active Aug 29, 2015
cmd.exe futzing
View output.txt
C:\Users\ionel_000>chcp 65001
Active code page: 65001
C:\Users\ionel_000>py -3
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.getlocale(locale.LC_ALL)
class CaptureOutput(object):
def __init__(self, *what):
self.__names = set(what)
self.__objects = {}
for name in self.__names:
assert isinstance(name, str)
assert name in ('stderr', 'stdout', '__stderr__', '__stdout__')
def __enter__(self):
for name in self.__names:
View tox.ini
envlist = py34
skipsdist = true
deps =
commands =
{posargs:py.test -vv}
View jsbin.yixage.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>JS Bin</title>
<script src=""></script>
<link rel="import" href="">
View flawed1.rst

T.__init__ doesn't get called, as it's the second last in the mro (because it doesn't inherit Base):

>>> class Base(object):
...         def __init__(self, a):
...                 print 'super chain terminated'
>>> class D(Base):
...         def __init__(self, a):
...                 print 'do stuff with', a
...                 super(D, self).__init__(a)
You can’t perform that action at this time.