Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Headache!

Zygmunt Krynicki zyga

🏠
Headache!
View GitHub Profile
@zyga
zyga / 92-lm4tools.rules
Created Oct 22, 2012
UDev rules for lm4tools (stellaris launchpad programmer)
View 92-lm4tools.rules
# TI LaunchPad Stellaris board (ICDI external programmer)
ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0660", GROUP="plugdev",
@zyga
zyga / integration-test.sh
Created Feb 19, 2013
Generate json result for plainbox jobs
View integration-test.sh
#!/bin/sh
junk=$(mktemp -d --suffix=.plainbox-junk)
logs=$(mktemp -d --suffix=.plainbox-logs)
echo "Going to temporary place: $junk"
echo "Log files and everything else: $logs"
cd $session
for job in $(plainbox special --list-jobs); do
job_mangled=$(echo $job | sed 's!/!_!g')
echo "Running $job... (output in $logs/$job_mangled.*)"
time plainbox run -r $job -o $logs/$job_mangled.json -f json >$logs/$job_mangled.out 2>$logs/$job_mangled.err
@zyga
zyga / example.py
Last active Sep 14, 2017
Experiment with python3 ast module
View example.py
import ast
class Visitor(ast.NodeVisitor):
def __init__(self):
self._names_seen = set()
def visit_Name(self, node):
self._names_seen.add(node.id)
node = ast.parse("all(package.name not in ['plainbox', 'tuxracer'])")
View shared.py
def shared(**kwargs):
class Shared(object):
@classmethod
def get_shared_data(cls):
return kwargs
return Shared
BaseSharedStuff = shared(username="user", password="pass")
@zyga
zyga / vboxbug.c
Created Mar 7, 2013
Test program for reproducing vboxfs bug, see text for details
View vboxbug.c
/*
Alleged vboxfs bug test program.
Copyright (c) 2013, Zygmunt Krynicki
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@zyga
zyga / iomediator.py
Last active Dec 15, 2015
Toy example for producer/consumer pattern that may either talk bytes or strings
View iomediator.py
#!/usr/bin/env python3
# Producers
def text_producer() -> str:
yield "I write"
yield "some text"
yield "some of which zażółć gęślą jaźń is in Polish"
@zyga
zyga / vbox-iscsi.sh
Created Apr 1, 2013
Attach iSCSI disk to VirtualBox, works without auth
View vbox-iscsi.sh
VBoxManage storageattach "Ubuntu Precise Server" --storagectl "SATA" --port 0 --device 0 --type hdd --medium iscsi --server 192.168.0.5 --target "iqn.2013-01.silverbox:precise-server" --tport 3260
@zyga
zyga / testtrace.py
Created Apr 3, 2013
Experiment in tracing tests back to source they execute
View testtrace.py
#!/usr/bin/env python
from __future__ import absolute_import, print_function, unicode_literals
from collections import defaultdict, namedtuple
from gettext import gettext as _, ngettext
from unittest import TestCase
from unittest.loader import TestLoader
from unittest.result import TestResult
from unittest.suite import TestSuite
@zyga
zyga / mcls2.py
Created Apr 10, 2013
python metaclass trickery, type() vs type.__new__()
View mcls2.py
#!/usr/bin/env python2
class Meta(type):
def __new__(mcls, name, bases, ns):
ns['_meta_for'] = name
return type.__new__(mcls, name, bases, ns)
class Base(object):
@zyga
zyga / display-port-audio-test-program.txt
Last active Dec 16, 2015
Display Port test program (plan)
View display-port-audio-test-program.txt
# Display Port Audio Test Program
# -------------------------------
#
# Goal:
# To play sound through the attached monitor,
# connected using a display port cable,
# without using a passive adapter.
# Purpose:
# To aid in manual testing of audio for hardware certification
# Requirements: