Skip to content

Instantly share code, notes, and snippets.

@curzona
curzona / example_steps.py
Created March 5, 2016 11:24
behave example
# -- FILE: features/steps/example_steps.py
from behave import given, when, then, step
import time
@given('we have behave installed')
def step_impl(context):
time.sleep(1)
@when('we implement {number:d} tests')
def step_impl(context, number): # -- NOTE: number is converted into integer
import win32com.client
import win32gui
wmp = win32com.client.dynamic.Dispatch("WMPlayer.OCX")
wmp.settings.autoStart = True
wmp.settings.volume = 50
wmp.URL = "sample.wma"
while wmp.Playstate != 1:
win32gui.PumpWaitingMessages()
# rc definitions for dark backgrounds
lines.color: white
patch.edgecolor: white
text.color: white
axes.facecolor: black
axes.edgecolor: white
axes.labelcolor: white
import pyaudio
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):
print p.get_device_info_by_index(i)
@curzona
curzona / vlc_audio_output_device_switching.py
Created November 10, 2015 09:42
vlc_audio_output_device_switching
import vlc
import time
p = vlc.MediaPlayer("organfinale.wav")
p.play()
device = p.audio_output_device_enum()
while device:
print "playing on..."
def assert_file_equal(a, b):
a = open(a, "rb").read()
b = open(b, "rb").read()
if a != b:
diff = difflib.ndiff(a.splitlines(True),
b.splitlines(True))
message = ''.join(diff)
raise AssertionError("Not equal:\n" + message)
@curzona
curzona / devcon_examples.bat
Created August 15, 2015 07:16
DevCon examples
set DEVCON="C:\Program Files (x86)\Windows Kits\10\Tools\x64\devcon.exe"
REM DevCon hwids - https://msdn.microsoft.com/en-us/library/windows/hardware/ff544772(v=vs.85).aspx
%DEVCON% hwids invalid > devcon_hwids_invalid.txt 2>&1
%DEVCON% hwids * > devcon_hwids_star.txt 2>&1
%DEVCON% hwids =AudioEndpoint > devcon_hwids_class.txt 2>&1
%DEVCON% hwids MMDEVAPI\AudioEndpoints > devcon_hwids_hwid.txt 2>&1
%DEVCON% hwids @SWD\MMDEVAPI\{0.0.0.00000000}.{32247EDD-EAC6-46F8-BEFB-44448BDBC8D3} > devcon_hwids_instanceid.txt 2>&1
REM DevCon classes - https://msdn.microsoft.com/en-us/library/windows/hardware/ff544712(v=vs.85).aspx
@curzona
curzona / .travis.yml
Last active July 17, 2017 10:56
Comparison of config files
# see http://about.travis-ci.org/docs/user/languages/php/ for more hints
language: php
# list any PHP version you want to test against
php:
# using major version aliases
# aliased to 5.2.17
- 5.2
# aliased to 5.3.29
@curzona
curzona / ant-junit.xml
Last active August 29, 2015 14:26
Comparison of junit-xml results
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="2" hostname="curzona-desktop" name="TestHelloJUnit" skipped="0" tests="2" time="0.049" timestamp="2015-07-31T06:46:01">
<properties>
<property name="ant.project.invoked-targets" value="test" />
<property name="java.runtime.name" value="OpenJDK Runtime Environment" />
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64" />
<property name="java.vm.version" value="24.79-b02" />
<property name="ant.library.dir" value="/usr/share/ant/lib" />
<property name="ant.version" value="Apache Ant(TM) version 1.9.3 compiled on April 8 2014" />
<property name="ant.java.version" value="1.7" />
@curzona
curzona / run.sh
Created July 11, 2015 02:23
Run python function from command line
#!/bin/bash
python -c "import thing; thing.foo()"