Skip to content

Instantly share code, notes, and snippets.

@george-hawkins
george-hawkins / wake-issue.md
Last active December 7, 2025 19:55
After installing Ubuntu 20.04 my machine frequently wakes from sleep for no obvious reason. This gist describes my attempts to resolve this.

Diagnosing spurious wakes

This gist documents my attempts to get to the bottom of spurious wakes after installing Ubuntu 20.04 LTS on my system.

Initially, I thought it might be another system on my network sending Wake-on-LAN (WoL) packets. Then I thought it might be a known XHCI spurious wake kernel issue. And lastly, I finally resolved things by actively disabling the ability of USB devices, e.g. the mouse, to wake the system.

Update: I later came up with a better way of disabling wake-on-mouse that's covered here.

Note: as one of these steps, I upgraded the system BIOS - while this didn't resolve this particular issue, it did resolve an annoying issue with the graphic state not being properly restored for certain applications after wake-up.

@george-hawkins
george-hawkins / README.md
Last active November 21, 2025 06:19
Forcing GitHub to reindex your repos

Forcing GitHub to reindex your repos

Apparently, GitHub stops indexing repos that have not had a commit for over a year. They say this is to ensure that search limits itself to providing the most relevant results.

But this is a pain if you know your own repos contain some particular information but GitHub turns up no search results because of this constraint.

A way to force a reindex of a repo is to search it - you may get no results but GitHub will put the repo in a queue to be reindexed and in about 5 minutes the same search may produce a result if the repo contains the relevant term.

However, if you don't know the relevant repo and want to search all your repos, it's somewhat inconvenient to have to manually search them all to force a reindex.

@george-hawkins
george-hawkins / arm64.md
Last active May 27, 2025 15:47
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU

QEMU arm64 cloud server emulation

This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.

Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/

Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/

Determine your current username and get your current ssh public key:

@george-hawkins
george-hawkins / 00-README.md
Last active February 12, 2025 20:50
Disabling HP Omen 25L case LEDs

Disabling HP Omen 25L case LEDs

If you're running Windows then you can disable the case LEDs in an HP Omen computer using the Omen Gaming Hub.

However, there's no equivalent for Linux and no obvious way to permanently disable the LEDs.

When restarting after a shutdown, the LEDs start enabled but if you boot into Windows and, if you've already disabled the LEDs via the Omen Gaming Hub, they will automatically become disabled again as part of Windows starting up. You can then reboot into Linux and they will stay disabled until you next shutdown and restart.

This is hardly ideal - a more permanent and simple approach is to simply unplug the power connector for the LEDs on the motherboard. It's clearly marked "LED":

@george-hawkins
george-hawkins / README.md
Last active October 21, 2024 06:11
Turn off HP Omen desktop lighting

Turn off HP Omen desktop lighting

To turn off case lighting go to the Microsoft Store, search for and install OMEN Gaming Hub.

There's no need for any of the secondary installs that it tries to trigger - i.e. Light Studio and HP System Event Utility.

Open OMEN Gaming Hub - ignore any attempt to make you sign-in or register for an account.

Ignore Light Studio, click OMEN Desktop and select the Lighting tab.

@george-hawkins
george-hawkins / serial_tester.py
Created March 2, 2024 15:33
Code accompanying function call overhead question on MicroPython forums
import argparse
import statistics
import time
import zlib
import serial
TIMESTAMP_BYTE_COUNT = 8
CRC_BYTE_COUNT = 4
@george-hawkins
george-hawkins / yield-example.py
Created February 25, 2024 14:29
Working with `yield` in Python
def foo():
for i in range(0, 16):
print(f"> {i}")
j = yield i
print(f"> {j}")
yield j
print(f"* 1")
gen = foo()

BLE Nano and the nRF51822 SDK

If you've tried using the nRF51822 SDK with the BLE Nano (after following the RedBearLab guide) you may have come to a dead end.

Even the simplest examples didn't work for me. I assumed I had a dead Nano (despite the upload process seeming to work fine).

The reason turned out to be that the latest SDK versions assume you have a nRF51822 chip with 32KB of RAM rather than the 16KB that the nRF51822 on the Nano has.

James Willcox explains this in a post to the RedBearLab BLE Nano support forum.

pyenv update
pyenv install -l
pyenv install 3.10.8
pyenv global 3.10.8

Show CUDA version: