Skip to content

Instantly share code, notes, and snippets.

@jodoherty
jodoherty / A4Part1.py
Last active October 17, 2016 00:33
Example for easily creating and running test cases for sms-tools assignments
# ...
import numpy as np
def extractMainLobe(window, M):
# ...
return np.zeros(M)
if __name__ == '__main__':
# The check above ensures the following code only runs if we run this
@jodoherty
jodoherty / gvim
Created September 9, 2017 13:56
Run native Windows gvim from within msys or cygwin
#!/bin/bash
GVIM=/c/Windows/gvim.bat
args=()
TEMP="$(cygpath -w "$ORIGINAL_TEMP")"
for arg in "$@"; do
if [[ $arg == /* ]]; then
args+="$(cygpath -w "$arg")"
@jodoherty
jodoherty / download.go
Created October 6, 2017 21:07
Recursive relative path downloader
package main
import (
"errors"
"fmt"
"golang.org/x/net/html"
"io"
"net/http"
"net/url"
"os"
@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
@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 / 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 / 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 / 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 / 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"