This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⎡ ⎛ ⎛ ⎛ c⋅e⎞ ⎞ ⎛ ⎛ d⋅e⎞ ⎛ b⋅i⎞ ⎞ ⎞ ⎛ ⎛ ⎛ b⋅i⎞ ⎞ ⎛ ⎛ c⋅e⎞ ⎛ b⋅m⎞ ⎞ ⎞ ⎛ ⎛ ⎛ c⋅e⎞ ⎛ b⋅m⎞ ⎞ ⎞ ⎛ ⎛ ⎛ c⋅e⎞ ⎞ ⎛ ⎛ d⋅e⎞ ⎛ b⋅i⎞ ⎞ ⎞ ⎛ ⎛ ⎛ c⋅e⎞ ⎞ ⎛ ⎛ d⋅e⎞ ⎛ b⋅i⎞ ⎞ ⎞ ⎛ ⎛ ⎛ c⋅e⎞ ⎞ ⎛ ⎛ d⋅e⎞ ⎛ b⋅i⎞ ⎞ ⎞ ⎤ | |
⎢ ⎜ ⎜ b⋅⎜g - ───⎟ ⎟ ⎜ ⎜h - ───⎟⋅⎜j - ───⎟ ⎟ ⎟ ⎜ ⎜e⋅⎜j - ───⎟ ⎟ ⎜ ⎜g - ───⎟⋅⎜n - ───⎟ ⎟ ⎟ ⎜ ⎜ ⎜g - ───⎟⋅⎜n - ───⎟ ⎟ ⎟ ⎜ ⎜ b⋅⎜g - ───⎟ ⎟ ⎜ ⎜h - ───⎟⋅⎜j - ───⎟ ⎟ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
export project=freeipa | |
export username=pviktori | |
export localrepo=~/dev/freeipa | |
export patchdir=~/patches/in | |
export remote=vm081 | |
# Usage: getpatch <patchnumber> [num_patches] | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# Encoding: UTF-8 | |
# | |
# Print an image that is given as a command-line parameter. | |
# | |
# If nothing is given, read the image from stdin. | |
# | |
# Only works on utf8 256-color-xterm-like terminals. No checks are done to | |
# enforce this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
def func(a, b, c, d=4, **kw): | |
print(a, b, c, kw) | |
def call(func, *args, **kwargs): | |
try: | |
params = inspect.signature(func).bind(*args, **kwargs) | |
except TypeError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=============================================================================== | |
9:20 Immutability in Clojure, Ruby, JavaScript, and Python | |
- Tero Parviainen | |
wormholes | |
Clojure view - everything should be immutable | |
Scores languages based on how close to Clojure they are... ??! | |
Ruby - can use mutable objects as hash keys; hashes are indexed "by value" | |
- freeze() on objects (shallow; lib with deep_freeze) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
def sieve(ints): | |
prime = next(ints) | |
yield prime | |
yield from sieve(i for i in ints if i % prime) | |
for i in sieve(iter(range(2, 3000))): | |
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from weakref import WeakKeyDictionary | |
class TupleProperty: | |
def __init__(self, *default_value): | |
self.values = WeakKeyDictionary() | |
self.length = len(default_value) | |
self.default_value = default_value | |
def __get__(self, obj, cls=None): | |
if obj: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a comment on http://eli.thegreenplace.net/2014/04/02/dynamically-generating-python-test-cases/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
# for an async presentation at Ostravské Pyvo, 2014-06-05 | |
# - http://srazy.info/pyvo-v-ostrave/4591 | |
# - http://lanyrd.com/2014/ostrava-pyvo-june/ | |
import random | |
import time | |
import asyncio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
# Python 3.4+ | |
import inspect | |
def fix_public_signature(func): | |
"""Remove private arguments from the signature of a function | |
Private arguments are keyword-only, and prefixed by an underscore. | |
""" |