Skip to content

Instantly share code, notes, and snippets.

@holmanb
holmanb / gist:1a222dd82a568e0278ac2afec0e95736
Last active March 22, 2025 20:32
Getting Started With Linux Kernel Running Qemu On Fedora With Mkosi

Note: I need to do this on multiple machines, and it took a while to figure out the easiest way to do this on Fedora, so I'm documenting the process.

  1. Get & Configure the Kernel
git clone https://github.com/torvalds/linux.git
cd linux
make allnoconfig
make x86_64_defconfig
@holmanb
holmanb / vagrant-ubuntu.md
Last active December 18, 2020 00:06
Vagrant Notes

Vagrant Ubuntu 16.04 Example

mkdir folder_of_awesomeness
cd folder_of_awesomeness/
vagrant init bento/ubuntu-16.04
vagrant up --provider=virtualbox    # because they don't have a libvert provider
vagrant ssh
@holmanb
holmanb / concatenate_test.py
Last active May 2, 2021 01:07
Python String Concatenation Performance Test
#!/usr/bin/python
# concatenate_test.py
# based on https://stackoverflow.com/a/24718551/7407726
# modified to include f string benchmarking for a task I'm working on now, might come in handy later
from __future__ import print_function
import timeit
domain = 'some_really_long_example.com'
lang = 'en'
Problem #1: deleted snapshots consume filepath name
root@hostname-kvm:~/bcachefs-tools# /root/bcachefs-tools/bcachefs subvolume snapshot /mount/subvol_1 /mount/snapshot_1
root@hostname-kvm:~/bcachefs-tools# /root/bcachefs-tools/bcachefs subvolume delete /mount/snapshot_1/
root@hostname-kvm:~/bcachefs-tools# /root/bcachefs-tools/bcachefs subvolume snapshot -r /mount/subvol_1 /mount/snapshot_1
BCH_IOCTL_SUBVOLUME_CREATE ioctl error: File exists
Problem #2: snapshot of a deleted subvolume can't be deleted
Output:
00020 Running tests subvol_create subvol_delete subvol_delete_snapshot_of_deleted_subvol subvol_snapshot_create subvol_snapshot_delete subvol_snapshot_reuse_snapshot_name
00020
00020 ========= TEST subvol_create
00020
00020 bcachefs (sdb): recovering from clean shutdown, journal seq 4
00020 bcachefs (sdb): going read-write
00020 bcachefs (sdb): mounted with opts: (null)
00020
00020 ========= PASSED subvol_create in 0s
00026 Passed: subvol_create subvol_delete subvol_snapshot_create subvol_snapshot_delete
00026 Failed: subvol_delete_snapshot_of_deleted_subvol subvol_snapshot_reuse_snapshot_name
00026 TEST FAILED
00363 watchdog: BUG: soft lockup - CPU#3 stuck for 54671s! [swapper/3:0]
00363 Modules linked in:
00363 CPU: 3 PID: 0 Comm: swapper/3 Not tainted 5.13.0-354627-g6c5219caf0cc #3
00363 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
00363 RIP: 0010:default_idle+0xe/0x10
00363 Code: 8b 04 25 c0 6c 01 00 f0 80 60 02 df c3 0f ae f0 0f ae 38 0f ae f0 eb b6 0f 1f 40 00 e9 07 00 00 00 0f 00 2d dc ad 5e 00 fb f4 <c3> cc 55 48 89 e5 53 65 8b 15 4c 50 7f 7e 0f 1f 44 00 00 e8 7a 56
00363 RSP: 0018:ffff8880029e3ee0 EFLAGS: 00000212

so typically I run gdb like:

gdb --with-args ./mycmd arg1 arg2

break <function name>                            # set a breakpoint
break <filename>:<function name>:<line_nr>       # set a breakpoint

run                                              # starts the program

root@me:~# cloud-init devel schema --docs cc_write_files
Write Files
-----------
**Summary:** write arbitrary files
Write out arbitrary content to files, optionally setting permissions.
Parent folders in the path are created if absent.
Content can be specified in plain text or binary. Data encoded with
either base64 or binary gzip data can be specified and will be decoded
0 require "lspconfig".pyright.setup {
1 on_attach = on_attach,
2 capabilites = capabilities, -- from nvim-cmp
3 lintIgnoreExitCode = true,
4 settings = {
5 python = {
6 analysis = {
7 diagnosticSeverityOverrides = {
8 reportUnusedVariable = "error"