Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Headache!

Zygmunt Krynicki zyga

🏠
Headache!
View GitHub Profile
@zyga
zyga / dir-scanner
Created Jun 4, 2014
Directory scanner / hash collector
View dir-scanner
#!/usr/bin/env python3
#
# Copyright (c) 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:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
View keybase.md

Keybase proof

I hereby claim:

  • I am zyga on github.
  • I am zyga (https://keybase.io/zyga) on keybase.
  • I have a public key whose fingerprint is B76C ED9B 45CA F155 7D27 1A6A 2894 E93A 28C6 7B47

To claim this, I am signing this object:

View example.py
class NS:
PASSTHRU = frozenset(('__name__', '__qualname__', '__doc__', '__module__'))
def __init__(self, data=None):
if data is None:
data = {}
self.data = data
def __setitem__(self, name, value):
@zyga
zyga / signal_naming.py
Created Feb 27, 2015
Example on naming singnals in checkbox
View signal_naming.py
class JobCollection:
@signal
def job_added(self, job):
""" signal sent whenever a job is added """
class SomethingElse:
def __init__(self, collection):
col.job_added.connect(on_job_added)
@zyga
zyga / lantern-collect
Last active Aug 29, 2015
Basic backlight data collection script for Lantern
View lantern-collect
#!/bin/sh
# Basic backlight data collection script for Lantern
# Written by Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
set -x
id=$(cat /proc/sys/kernel/random/uuid)
dest=$(mktemp -d --suffix=-lantern)
lspci > "$dest/lspci"
lsmod > "$dest/lsmod"
uname -a > "$dest/uname"
if [ -e /etc/os-release ]; then
@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
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"