Skip to content

Instantly share code, notes, and snippets.

View jarovo's full-sized avatar

Jaroslav Henner jarovo

View GitHub Profile
@jarovo
jarovo / Fakturoid.v3.yaml
Created January 10, 2026 13:51
Fakturoid API
openapi: 3.1.1
info:
title: Web-scraped Fakturoid V3 API
description: This is web-scraped definition of Fakturoid.
contact:
name: Jaroslav Henner
url: https://github.com/jarovo/fakturoid-api/
license:
name: >-
Web-scraped Fakturoid API V3 © 2025 by Jaroslav Henner is licensed under
import os
import subprocess
import pathlib
import sys
_BASE = pathlib.Path(__file__).parent / "scripts"
def _run(script_name: str):
script = _BASE / script_name
if not script.exists():
@jarovo
jarovo / latency.markdown
Created August 31, 2023 08:57 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@jarovo
jarovo / latency.txt
Created August 31, 2023 08:55 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jarovo
jarovo / read_te485.py
Last active September 21, 2019 13:11
Papouch TE485 modbus mode reading
from __future__ import print_function
import serial
from pymodbus.client.sync import ModbusSerialClient
from time import sleep
import ctypes
mb=ModbusSerialClient(method='rtu', port='/dev/extcomm/0/0', stopbits=1, bytesize=8,
parity=serial.PARITY_NONE, baudrate=19200, timeout=.1)
upper_limit=40
## Now with python3k support!
$ python foo.py &
[1] 21377
$ gdb -p 21377
GNU gdb (GDB) Fedora 7.7.1-17.fc20
[... gdb loading messages ...]
0x00007f9a09af46e3 in __select_nocancel () at ../sysdeps/unix/syscall-template.S:81
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)