Skip to content

Instantly share code, notes, and snippets.

View stsquad's full-sized avatar

Alex Bennée stsquad

View GitHub Profile
@stsquad
stsquad / gist:753f9651678ac188cec73afbded18bae
Created July 4, 2025 10:53
Booting up an Amazon image under TCG in QEMU
./qemu-system-aarch64 -serial mon:stdio \
-machine type=virt,virtualization=on,pflash0=rom,pflash1=efivars,gic-version=max \
-cpu neoverse-n1 -smp 4 -accel tcg \
-device virtio-net-pci,netdev=unet \
-device virtio-scsi-pci \
-device scsi-hd,drive=amazon \
-netdev user,id=unet,hostfwd=tcp::2222-:22 \
-blockdev driver=qcow2,node-name=amazon,file.driver=file,file.filename=/home/alex/images/al2023-kvm-2023.7.20250623.1-kernel-6.1-arm64.xfs.gpt.qcow2 \
-blockdev node-name=rom,driver=file,filename=(pwd)/pc-bios/edk2-aarch64-code.fd,read-only=true \
-blockdev node-name=efivars,driver=file,filename=$HOME/images/qemu-arm64-efivars \
@stsquad
stsquad / personal-cleanup-old-lkml.js
Created May 11, 2023 09:29
Google App Script to cleanup my old lkml emails while keeping threads I'm in
/*
* Based on the original from http://www.skipser.com/p/2/p/auto-delete-email-in-any-gmail-label-.html
*
* Tweaked to keep messages from mythreads
*/
// The name of the Gmail Label that is to be checked for purging?
var LABEL_TO_DELETE = "kernel/lkml";
// But not these labels
var LABEL_TO_KEEP = "mythreads";
from __future__ import print_function
#
# This script needs to be run on startup
# qemu -kernel ${KERNEL} -s -S
# and then:
# gdb ${KERNEL}.vmlinux -x ${QEMU_SRC}/tests/guest-debug/test-ss.py
#
# This is a soak test for single-stepping which attempts to detect
# failed single-steps by single stepping a whole kernel.

QEMU Status Report

My other machine is virtual

$ ./configure --target-list=aarch64-linux-user --static
$ make

Solving the HKG18 puzzle with org-mode

(defvar my-overlays nil)
(let ((start (point-min)))
(save-excursion
(goto-char start)
(while (re-search-forward "aaaa" nil t)
(let ((overlay (make-overlay start (- (match-beginning 0) 1))))
(add-to-list 'my-overlays overlay))
(forward-line)
(setq start (point)))))
@stsquad
stsquad / gist:8316550
Created January 8, 2014 13:11
Add the ability to run checkpatch from magit
;;;
;; Run checkpatch.pl if we can
;;
(defvar magit-checkpatch-script nil
"Path to local checkpatch script, if it exists.")
(make-variable-buffer-local 'magit-checkpatch-script)
(put 'magit-checkpatch-script 'permanent-local t)
;; Match checkpatch.pl output
(add-to-list
@stsquad
stsquad / gist:5124431
Created March 9, 2013 15:02
Current scratch version
(defvar mark-list-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map tabulated-list-mode-map)
(define-key map (kbd "RET") 'mark-list-visit-buffer)
(define-key map "\C-m" 'mark-list-visit-buffer)
(define-key map (kbd "d") 'mark-list-delete-mark)
map)
"Local keymap for `mark-list-mode-mode' buffers.")
(defvar mark-list-current-mark-list nil