Skip to content

Instantly share code, notes, and snippets.

#!/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')
@jodoherty
jodoherty / qwerty.txt
Created November 6, 2022 17:44
Kinesis Advantage2 layout
[caps]>[escape]
[lalt]>[kpshft]
[rwin]>[kpshft]
[home]>[lwin]
[pup]>[rwin]
[intl-\]>[caps]
[end]>[lalt]
[pdown]>[ralt]
[kp-y]>[pause]
[kp-caps]>[escape]
@jodoherty
jodoherty / .gvimrc
Last active July 9, 2020 02:19
VIM settings
if has("win32")
set guifont=Consolas:h10
set guioptions=aegimrL
else
set guifont=Monospace\ 11
set guioptions=imrL
endif
set showtabline=2
set columns=85