Skip to content

Instantly share code, notes, and snippets.

View michalsieron's full-sized avatar

Michał Sieroń michalsieron

View GitHub Profile
@michalsieron
michalsieron / meson.build
Last active September 5, 2025 19:51
compile with `g++ re2-repro.cpp -DSHARED -O2 -o re2-shared -lre2` or `g++ re2-repro.cpp -O2 -o re2-separate -lre2`. For PCRE use `-DUSE_PCRE -lpcre`
project('repro', 'cpp')
foreach lib : ['re2', 'libpcre']
dep = dependency(lib, required: true)
lib = lib.replace('lib', '')
foreach sharing : ['shared', 'separate']
executable(
lib + '-' + sharing,
sources: ['repro.cpp'],
cpp_args: ['-D' + sharing.to_upper(), '-DUSE_' + lib.to_upper()],
@michalsieron
michalsieron / zig-hash.sh
Created April 24, 2024 18:35
Get multihash that zig calculates when fetching dependencies
#!/usr/bin/env sh
# Usage: zig-hash <path to build.zig.zon>
BUILD_ZIG_ZON="${1:-build.zig.zon}"
ROOT_DIR="$(dirname "$BUILD_ZIG_ZON")"
# Get hash of a file, which is computed from:
# - its normalized filepath
# - followed by two null bytes (apparently temporary solution in Zig, only for normal files)
# - followed by actual file content
@michalsieron
michalsieron / xfdf.py
Last active May 29, 2021 21:35
Transform Adobe Acrobat Reader comment xfdf file to txt
"""Transform Adobe Acrobat Reader comment xfdf file to txt.
Usage: python3 xfdf.py <file_path>
Run in the same directory as xfdf file, because there is no path
validation. There should be a file of the same name, but txt
extension created next to the original xfdf file.
"""
import sys
@michalsieron
michalsieron / Materialistic Export
Last active November 22, 2024 03:47
Materialistic Export
Alar: The making of an open-source dictionary
https://zerodha.tech/blog/alar-the-making-of-an-open-source-dictionary/
https://news.ycombinator.com/item?id=24615530
How Many Decimals of Pi Do We Really Need? (2016)
https://www.jpl.nasa.gov/edu/news/2016/3/16/how-many-decimals-of-pi-do-we-really-need/
https://news.ycombinator.com/item?id=24616797
In Defense of XML
https://blog.frankel.ch/defense-xml/
@michalsieron
michalsieron / codepoints.py
Last active July 4, 2020 12:33
Python script used to generate _crates/theme/src/vector_graphics/material_icons_font_ttf.rs_ for [redox-os/orbtk](https://github.com/redox-os/orbtk)
#!/usr/bin/python3
def chunks(lst: list, n:int=4):
"""`Yield`s `list`s of lenght `n` from given list `lst`"""
for i in range(0, len(lst), n):
yield lst[i:i+n]
# path to _.css_ file containing definitions of classes for glyphs
# [the one used originally](https://raw.githubusercontent.com/material-icons/material-icons-font/master/css/baseline.css)