Skip to content

Instantly share code, notes, and snippets.

View ignacysokolowski's full-sized avatar

Ignacy Sokolowski ignacysokolowski

  • Berlin, Germany
  • 23:00 (UTC +02:00)
  • X @ignacy
View GitHub Profile
@ignacysokolowski
ignacysokolowski / datastructure.py
Created March 15, 2017 17:52
Python 3.6 data structure
import pytest
class _DataStructureMeta(type):
def __new__(cls, class_name, bases, members):
try:
annotations = members['__annotations__']
except KeyError:
pass
@ignacysokolowski
ignacysokolowski / gist:5584572
Created May 15, 2013 14:51
Shell function for running PyTest with coverage and linting on specified application part
# Run PyTest with coverage and linting on specified application part.
#
# Useful shortcut when you're working at one class/function/module and you
# don't want to run all your tests and need to measure coverage only for what
# you're currently testing.
#
# Example::
#
# $ test_part tests/test_views.py app/views.py -vsk LoginView
#
@ignacysokolowski
ignacysokolowski / pulse_simple_play.py
Created October 29, 2012 11:20
Python: Play a WAV file with PulseAudio simple API
#!/usr/bin/env python
import ctypes
import wave
import sys
pa = ctypes.cdll.LoadLibrary('libpulse-simple.so.0')
PA_STREAM_PLAYBACK = 1
PA_SAMPLE_S16LE = 3