Skip to content

Instantly share code, notes, and snippets.

@OscarL
OscarL / cue_to_mp3.py
Last active November 21, 2025 22:35 — 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'
@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 / 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 / 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 / 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 / compare_package.py
Last active November 2, 2025 13:56
Compare .hpkg locally built with haikuporter, with the one you have installed under /system/packages/
#!python3
"""
Compares the contents (disregarding files' sizes and timestamps) of Haiku packages (.hpkg).
Useful to see, at first glance, if our newly built package looks more or less like the older ones.
Usage:
> compare_packages.py <package_name>
> compare_packages.py <package1.hpkg> <package2.hpkg>
@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 / Updating-Patchsets-101.md
Last active January 7, 2026 10:10
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>
`time git status` for Haiku/Haikuports trees.
=============================================
HDD, Haiku 64 bits (VBox, Win10 host, unless otherwise noted)
Haiku tree
----------
hrev58287 | hrev58344 | hrev58344 (Host on PowerSaving mode) | hrev58344 (bare metal) | hrev58287 (bare metal)
@OscarL
OscarL / VirtualBox-graphics-howto.md
Created December 20, 2024 18:08
How to have decent video on VirtualBox.

How to have decent video on VirtualBox.

  • Make sure VM's OS type is set to Linux 64 bits.
  • On the VM's Settings -> Display, make sure "Graphics Controller" is "VMSVGA". 32 MB of "Video Memory" should be enough.
  • On Haiku, run "pkgman install vmware_addons", reboot.
  • Change resolution as you wish from the Screen preflet.

You should now be able to change modes as you like.

To make sure VirtualBox starts in the resolution you want: