Skip to content

Instantly share code, notes, and snippets.

@lubosz
lubosz / plot_packages.py
Created November 17, 2025 11:40
Plot Arch packages to matplotlib or draw.io.
#!/usr/bin/env python3
import argparse
from pathlib import Path
import subprocess
import pprint
import networkx as nx
import matplotlib.pyplot as plt
from lxml import etree
@lubosz
lubosz / count_occurrences.py
Last active November 9, 2025 11:06
Python script to count string occurances in a git repo
#!/usr/bin/env python3
import argparse
from pathlib import Path
import subprocess
from tabulate import tabulate
def main():
parser = argparse.ArgumentParser(prog='count-occurrences', description='Count string occurrences in git repo.')
@lubosz
lubosz / org.eclipse.smarthome.core.thing.Thing.json
Created January 12, 2019 11:59
IKEA of Sweden TRADFRI remote control in org.eclipse.smarthome.core.thing.Thing.json
"zigbee:device:000002D1:000b57fffe4aebd4": {
"class": "org.eclipse.smarthome.core.thing.internal.ThingImpl",
"value": {
"label": "IKEA of Sweden TRADFRI remote control",
"bridgeUID": {
"segments": [
"zigbee",
"coordinator_telegesis",
"000002D1"
]
@lubosz
lubosz / tradfri_discovery.log
Created January 12, 2019 11:57
Ikea Tradfri discovery and adding in OpenHAB 2 PaperUI with com.zsmartsystems.zigbee and org.openhab.binding.zigbee set to debug.
2019-01-12 12:43:29.970 [DEBUG] [gesis.internal.TelegesisFrameHandler] - RX Telegesis Data:+N=COO,11,08,E48C,60DB07B95A834630
2019-01-12 12:43:29.971 [DEBUG] [gesis.internal.TelegesisFrameHandler] - RX Telegesis Data:OK
2019-01-12 12:43:29.972 [DEBUG] [gesis.internal.TelegesisFrameHandler] - RX Telegesis: TelegesisDisplayNetworkInformationCommand [device=COO, channel=11, power=8, panId=58508, epanId=60DB07B95A834630, status=SUCCESS]
2019-01-12 12:43:30.974 [DEBUG] [gesis.internal.TelegesisFrameHandler] - TX Telegesis queue: 1
2019-01-12 12:43:30.975 [DEBUG] [gesis.internal.TelegesisFrameHandler] - TX Telegesis: TelegesisDisplayNetworkInformationCommand [device=null, channel=null, power=null, panId=null, epanId=null]
2019-01-12 12:43:30.977 [DEBUG] [gesis.internal.TelegesisFrameHandler] - TX Telegesis Data:AT+N?
2019-01-12 12:43:31.106 [DEBUG] [gesis.internal.TelegesisFrameHandler] - RX Telegesis Data:+N=COO,11,08,E48C,60DB07B95A834630
2019-01-12 12:43:31.107 [DEBUG] [gesis.internal.TelegesisFrameHandler] - R
$ vktrace -v full -p bin/cube -w . -tr frames-0-10
vktrace info: Running vktrace as parent process will spawn child process: bin/cube
vktrace info: Listening for connections on port 34201.
[w] vikApplication:191 | Failed to initialize wayland-xdg, falling back to xcb.
[d] vikRenderer:451 | instance: Enabling supported VK_KHR_surface.
[d] vikRenderer:451 | instance: Enabling supported VK_KHR_get_physical_device_properties2.
[d] vikRenderer:451 | instance: Enabling supported VK_KHR_xcb_surface.
vktrace info: vktrace_lib library loaded into PID 28711
vktrace info: Client: Connected to port 34201 successfully.
vktrace info: Connected on port 34201.
@lubosz
lubosz / validate_precision.py
Created May 17, 2018 00:11
Example that shows how torch saves more float precision than it prints by default
#!/usr/bin/env python3
import torch
from torch.autograd import Variable
import numpy as np
def load_embeddings(count):
word_embeddings = {}
@lubosz
lubosz / emulationstation-loop.sh
Last active September 21, 2021 01:02
RetroPie installation script of custom EmulationStation branch.
#!/usr/bin/env bash
rp_module_id="emulationstation-loop"
rp_module_desc="EmulationStation with main menu loop patch"
rp_module_licence="MIT https://raw.githubusercontent.com/RetroPie/EmulationStation/master/LICENSE.md"
rp_module_section="exp"
rp_module_flags="frontend"
function _update_hook_emulationstation-loop() {
_update_hook_emulationstation
13:45:27.0765 gbp-symbol-layout-stack-addin[ 9577]: WARNING: Failed to get symbol tree: Failed to create translation unit: AST read error
13:45:28.0265 gbp-symbol-layout-stack-addin[ 9577]: WARNING: Failed to find nearest scope: Failed to create translation unit: AST read error
13:45:38.0198 gbp-symbol-layout-stack-addin[ 9577]: WARNING: Failed to find nearest scope: Failed to create translation unit: AST read error
13:45:38.0825 gbp-symbol-layout-stack-addin[ 9577]: WARNING: Failed to find nearest scope: Failed to create translation unit: AST read error
@lubosz
lubosz / xiSample.cpp
Last active March 27, 2018 09:40
xime sync sample
// xiSample.cpp : program that captures 10 images and finish
//
#include "stdafx.h"
#ifdef WIN32
#include "xiApi.h" // Windows
#else
#include <m3api/xiApi.h> // Linux, OSX
#include <unistd.h>
@lubosz
lubosz / formats.txt
Created March 16, 2018 14:46
vive pro video formats
$ v4l2-ctl --list-formats-ext -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUYV 4:2:2
Size: Discrete 640x480
Interval: Discrete 0.017s (60.000 fps)
Size: Discrete 612x460
Interval: Discrete 0.017s (60.000 fps)