Skip to content

Instantly share code, notes, and snippets.

View vasi's full-sized avatar

Dave Vasilevsky vasi

  • Montreal
View GitHub Profile
@vasi
vasi / emoji-pick
Last active January 4, 2026 07:46
#dalitrixie
#!/bin/sh
emoji="$(perl -ne 'print "$1 $2\n" if /fully-qualified.*# (\S+) E\S+ (.*)/' \
/usr/share/unicode/emoji/emoji-test.txt \
| rofi -dmenu -i -p 'Emoji' \
| awk '{print $1}')"
if [ -n "$WAYLAND_DISPLAY" ]; then
echo -n "$emoji" | wl-copy
wtype -- "$emoji"
else
echo -n "$emoji" | xclip -selection clipboard
@vasi
vasi / dynamic-desktops
Last active January 4, 2026 07:46
Dynamically change the number of Compiz desktops #dalitrixie
#!/usr/bin/env python3
import sys
import compizconfig
if len(sys.argv) != 2:
print("Usage: dynamic-desktops [+N | -N]")
sys.exit(1)
change = int(sys.argv[1])
context = compizconfig.Context()

Cross-compiling for ArchPower

Here's how I setup reasonably fast builds for ArchPower 32-bit. There are many ways to do this, but this is what worked for me, and it made my builds much faster than native.

Warning: Cross-compiling could give you different results from compiling on a real POWER/PowerPC box! Usually it's fine, but be cautious about distributing the resulting binaries.

We'll use icecream to coordinate cross-compilation.

Build a toolchain targeting ArchPower

@vasi
vasi / test_segv.c
Last active October 26, 2025 06:04
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sched.h>
void print_maps(void *addr) {
char cmd[256];
snprintf(cmd, sizeof(cmd), "grep %lx /proc/%d/maps",
@vasi
vasi / ofchooser.cfg
Last active September 19, 2025 09:21
ofchooser.cfg
9 "Internal Mac OS 9" hd:9,\\:tbxi
# External OS 9 needs full path
f "FW Mac OS 9" /pci@f4000000/firewire@e/@1d20399007241/@4008/@0:10,\\:tbxi
x "Mac OS X" fwd:25,\\:tbxi
y Yellowdog fwd:12,yaboot
d "Debian sid" fwd:18,grub
a ArchPower fwd:20,grub
l Lubuntu fwd:22,yaboot
u "Front USB port" usb0/disk:2,\\:tbxi
o "Open Firmware" OF
@vasi
vasi / php-pear-1.10.13-4.azl3.src.rpm.log
Last active September 11, 2025 13:50
php-pear-1.10.13-4.azl3.src.rpm.log
time="2025-09-11T13:22:30Z" level=info msg="* Creating a ccache manager instance *"
time="2025-09-11T13:22:30Z" level=info msg=" ccache root folder : ()"
time="2025-09-11T13:22:30Z" level=info msg=" ccache remote configuration: ()"
time="2025-09-11T13:22:30Z" level=warning msg="Failed to initialize the ccache manager:\nCCache root directory cannot be empty."
time="2025-09-11T13:22:30Z" level=debug msg="Using (/usr/bin/pigz) to extract tar"
time="2025-09-11T13:22:30Z" level=info msg="Building (php-pear-1.10.13-4.azl3.src.rpm)."
time="2025-09-11T13:22:30Z" level=debug msg="Executing: [tar -I /usr/bin/pigz -xf /root/azurelinux/build/worker/worker_chroot.tar.gz -C /root/azurelinux/build/worker/chroot/php-pear-1.10.13-4.azl3]"
@vasi
vasi / ccache-stats.txt
Last active September 9, 2025 10:23
Azure Linux ccache
Cacheable calls: 2607 / 2622 (99.43%)
Hits: 2396 / 2607 (91.91%)
Direct: 2393 / 2396 (99.87%)
Preprocessed: 3 / 2396 ( 0.13%)
Misses: 211 / 2607 ( 8.09%)
Uncacheable calls: 15 / 2622 ( 0.57%)
Local storage:
Cache size (GiB): 5.0 / 5.0 (99.88%)
Cleanups: 20
Hits: 2396 / 2607 (91.91%)
@vasi
vasi / coredns-1.11.4-7.azl3.src.rpm.log
Created September 6, 2025 18:29
AzureLinux coredns build failure
time="2025-09-05T21:05:38Z" level=info msg="* Creating a ccache manager instance *"
time="2025-09-05T21:05:38Z" level=info msg=" ccache root folder : (/root/azurelinux/ccache)"
time="2025-09-05T21:05:38Z" level=info msg=" ccache remote configuration: (/root/azurelinux/toolkit/resources/manifests/package/ccache-configuration.json)"
time="2025-09-05T21:05:38Z" level=info msg=" loading ccache configuration file: /root/azurelinux/toolkit/resources/manifests/package/ccache-configuration.json"
time="2025-09-05T21:05:38Z" level=info msg=" Type : azure-blob-storage"
time="2025-09-05T21:05:38Z" level=info msg=" TenantId : "
time="2025-09-05T21:05:38Z" level=info msg=" UserName : "
time="2025-09-05T21:05:38Z" level=info msg=" StorageAccount : marinerccache"
time="2025-09-05T21:05:38Z" level=info msg=" ContainerName : 30-stable"
time="2025-09-05T21:05:38Z" level=info msg=" Tagsfolder : tags"
@vasi
vasi / mkofboot.sh
Last active August 29, 2025 19:20
mkofboot.sh
#!/bin/bash
output=${1-ofboot}
count=0
entries=()
addentry() {
count=$((count + 1))
entries+=("$@")
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
// Run: sudo ./test /sys/bus/pci/devices/*:00:10.0/resource2
char *file = argv[1];
fprintf(stderr, "file = %s\n", file);
int fd = open(file, O_RDWR | O_CLOEXEC);
fprintf(stderr, "fd = %d\n", fd);