Skip to content

Instantly share code, notes, and snippets.

@OscarL
OscarL / python_wheel-1.2.3.recipe
Created September 26, 2026 17:53
Some HaikuPorter .recipe templates for working with Python packages.
#
# Template for Python packages that provide a pre-built wheel (.whl) file suitable for use
# in several Python versions (eg.: "-py3-none-any.whl" ones).
#
# This template variant is for packages that DO NOT provide commands under /bin/
#
# Fill in the blanks, rename recipe according to package name and version.
#
# Remove the [hint] comments before submitting.
SUMMARY=""
@OscarL
OscarL / Haiku-ISOs.md
Last active September 25, 2026 20:48
Working with Haiku's "anyboot" .iso files.

From Terminal:

> diskimage register "/Data/haiku-nightly-anyboot.iso"
Registered file as disk device "/dev/disk/virtual/files/21/raw" with ID 21.
>
> diskimage list
    ID  File                               Device
-------------------------------------------------------------------------------
 21 /Data/haiku-nightly-anyboot.iso/dev/disk/virtual/files/21/raw
@OscarL
OscarL / gist:44dff94b7d7eb11c2ba61a03ab874a17
Created October 23, 2025 21:21
Basic bash function (place it on profile or bashrc) to quickly squash the N last commits.
squash_last_n_commits()
{
if [ $# -ne 1 ] || [ "$1" -lt 2 ]; then
echo 'squash_last_n_commits() requires a number (>1) as the only argument ("HEAD~$1")'
else
echo "Creating '__pre_squash__state__' tag, just in case."
git tag "__pre_squash__state__"
git reset --soft HEAD~$1 &&
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
if [ $? -ne 0 ]; then
@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:

`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 / Updating-Patchsets-101.md
Last active June 11, 2026 14:44
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 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 / 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