Skip to content

Instantly share code, notes, and snippets.

@OscarL
OscarL / Updating-Patchsets-101.md
Last active August 30, 2024 07:12
How to update .patchset files for HaikuPorter recipes, when they do not apply cleanly.

Updating HaikuPorter .recipes (and what to do when applying the .patchset fails).

An example-based, step-by-step guide.

TL;DR

# Let's start! (from the git repo on the work-dir for "package_name-1.2.3"):
> git am ../../../patches/<package_name-1.2.3.patchset>
@OscarL
OscarL / QueryTimings.txt
Created November 2, 2023 09:38
Timings of some queries on Haiku beta4 (indexed vs non-indexed attributes, first, vs repeated runs, exact vs "glob" queries, BFS vs PackageFS.
///////////////////////////////////////////////////////////////////////////////
// Beta4, 64 bits, SATA HDD 5400 RPM:
///////////////////////////////////////////////////////////////////////////////
[~/Desktop ]
> df
Mount Type Total Free Flags Device
----------------- --------- --------- --------- ------- ------------------------
/boot bfs 20.0 GiB 9.7 GiB QAM-P-W /dev/disk/ata/1/master/2_1
/boot/system packagefs 4.0 KiB 4.0 KiB QAM-P--
@OscarL
OscarL / compare_package.py
Last active September 25, 2023 04:38
Compare .hpkg locally built with haikuporter, with the one you have installed under /system/packages/
#!python3
"""
Usage:
> compare_package.py package_name
Compares contents (disregarding files' sizes and timestamps) of the given package_name from:
/system/packages/package_name-*.hpkg
@OscarL
OscarL / pkgman_list_not_required.py
Created May 5, 2023 12:56
Proof of Concept for `pkgman search --not-required`
#!python3
"""
Proof of concept for `pkgman search --not-required`.
The idea is *very* simple.
- Get the list of installed packages.
- From that, builds a list of all unique requirements.
- Print the list of packages that do not provide any of those requirements.
@OscarL
OscarL / patchset_split.py
Created December 20, 2022 23:07
Split Haikuporter's .patchset files ("git am" mailboxes).
#! python3
"""
patchset_split.py
Based on Paolo Bonzini's mbox_split.py:
https://gist.github.com/bonzini/d5bc1946475487167c529f9699e39512
"""
import argparse
@OscarL
OscarL / test_pidof.py
Last active September 2, 2022 20:01
A script to test Haiku's pidof command.
"""
Test bench for Haiku's `pidof` command.
Requires at least Python 3.5 (for subprocess.run()).
Usage:
python3 test_pidof.py [path_to_pidof]
If no "path_to_pidof" is given, the one in $PATH, if any, will be used.
"""
@OscarL
OscarL / pidof.sh
Last active August 28, 2022 08:49
A pidof shell implementation for Haiku
#!/bin/sh
# Poor-man's pidof replacement for Haiku
#
# Usage: > pidof <ProcessName>
if [ "$#" -eq "1" ] ; then
ps -o Id Team | grep $1 | grep -v 'grep' | grep -v 'pidof' | grep -o '[0-9]*'
fi
@OscarL
OscarL / cue_to_mp3.py
Last active July 29, 2024 00:40 — forked from bancek/cue_to_mp3.py
CUE splitter using ffmpeg (to mp3)
# Changes over the original:
#
# + Support both Python 2 & 3.
# * fixed location of bitrate parameters.
# * Fixed track duration so it does't cuts tracks short, nor starts them early
# (Margin of error for .flac source files should at most be around +/- 0.013 secs).
# + Added pre_gap support.
cue_file = 'file.cue'