Skip to content

Instantly share code, notes, and snippets.

@jodoherty
jodoherty / main.py
Created March 26, 2025 02:02
Prefect extra loggers with threading example.
"""
Prefect extra loggers with threading example.
Run it like this:
PREFECT_LOGGING_EXTRA_LOGGERS=__main__ PREFECT_API_URL=http://127.0.0.1:4200/api python main.py
You should see the plain Python logging for the '__main__' package in the
Prefect UI.
@jodoherty
jodoherty / .Xresources
Last active February 10, 2025 15:39
uxterm customization
UXTerm.termName: xterm-256color
!UXTerm*font: -misc-fixed-medium-r-semicondensed-*-13-*-*-*-*-*-iso10646-1
UXTerm*font: -gnu-unifont-medium-r-normal-*-16-*-*-*-*-*-iso10646-1
!UXTerm*reverseVideo: true
UXTerm*loginShell: true
UXTerm*visualBell: true
UXTerm*visualBellLine: true
UXTerm*altSendsEscape: true
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority 0;
# accept any localhost traffic
iif lo accept
@jodoherty
jodoherty / 99-thinkpad.hwdb
Created February 3, 2024 23:06
Rebind PrtSc and CapsLock on Thinkpad laptops
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPad*
KEYBOARD_KEY_b7=rightmeta
KEYBOARD_KEY_3a=leftctrl
@jodoherty
jodoherty / pc-keys-for-terminals.json
Last active November 11, 2023 01:29
Karabiner Elements rule to use a PC style modifier key layout for terminals and VMs
{
"title": "PC Keys for terminals/VMs",
"rules": [
{
"description": "Swap around modifiers",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_command",
@jodoherty
jodoherty / Rule.swift
Created March 28, 2023 01:35
Modeling with JSON in Swift
//
// Rule.swift
//
// Created by James O'Doherty on 3/27/23.
//
import Foundation
struct Rule: Codable, Identifiable {
var id: String
@jodoherty
jodoherty / misc.swift
Created March 24, 2023 03:12
Encoding/decoding struct as JSON embedded in a binary plist
import ArgumentParser
import Foundation
struct MyStruct: Codable {
var id: Int = 0
var name: String = ""
var port: Int?
}
let myStructKey = "myStructs"
@jodoherty
jodoherty / README.md
Created March 19, 2023 19:32
Remapping MacBook pro keys

This hidutil command remaps the following keys on the internal MacBook Pro keyboard:

  1. caps lock is remapped to esc
  2. right command is remapped to right option
  3. right option is remapped to right ctrl

I use these remappings because I spend most of my time working in the terminal or in Emacs, so having an extra command key is less important to me than having symmetric left/right ctrl and option keys.

To use com.local.KeyRemapping.plist, place it in ~/Library/LaunchAgents/

@jodoherty
jodoherty / 99-thinkpad-t14.hwdb
Last active January 30, 2023 01:25
Thinkpad udev keyboard tweaks
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrThinkPad*
KEYBOARD_KEY_b7=rightmeta
KEYBOARD_KEY_3a=esc
KEYBOARD_KEY_01=capslock
@jodoherty
jodoherty / init.vim
Created January 24, 2023 03:08
neovim
set ts=8
set sw=2
set sts=2
set et
set cc=80,120
set list
set mouse=a
if has('win32') || has('win64')