Skip to content

Instantly share code, notes, and snippets.

View msolomon's full-sized avatar

Mike Solomon msolomon

View GitHub Profile
@msolomon
msolomon / init.lua
Last active October 22, 2020 13:02
-- Mike Solomon @msol 2019
local log = hs.logger.new('main', 'info')
DEVELOPING_THIS = false -- set to true to ease debugging
HYPER = {'ctrl', 'shift', 'alt', 'cmd'}
-- App bindings
function setUpAppBindings()
hyperFocusAll('w', 'React Native Debugger', 'Simulator', 'qemu-system-x86_64')
<item>
<name>Tap shift to move over words</name>
<appendix>Shift keys move the cursor one word forward or backward when pressed alone. When used with other keys they act as normal shifts.</appendix>
<identifier>private.shifts_to_forward_backward_word</identifier>
<autogen>--KeyOverlaidModifier-- KeyCode::SHIFT_R, ModifierFlag::SHIFT_R | ModifierFlag::NONE, KeyCode::SHIFT_R, KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_L</autogen>
<autogen>--KeyOverlaidModifier-- KeyCode::SHIFT_L, ModifierFlag::SHIFT_L | ModifierFlag::NONE, KeyCode::SHIFT_L, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen>
</item>
@msolomon
msolomon / shift_move_word.xml
Created December 2, 2014 17:02
Karabiner - Tap shift to move wordwise
<?xml version="1.0"?>
<root>
<item>
<name>Tap shift to move wordwise</name>
<appendix>Shifts move the cursor one word forward or backward when pressed alone. When used with other keys they act as normal shifts.</appendix>
<identifier>private.shifts_to_forward_backward_word</identifier>
<autogen>--KeyOverlaidModifier-- KeyCode::SHIFT_R, ModifierFlag::SHIFT_R | ModifierFlag::NONE, KeyCode::SHIFT_R, KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_L</autogen>
<autogen>--KeyOverlaidModifier-- KeyCode::SHIFT_L, ModifierFlag::SHIFT_L | ModifierFlag::NONE, KeyCode::SHIFT_L, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen>
@msolomon
msolomon / private.xml
Created March 18, 2014 06:03
Programmer Dvorak snippet for KeyRemap4MacBook
<item>
<name>Use Programmer Dvorak - Qwerty Keyboard Layout</name>
<appendix>(QWERTY to Programmer Dvorak)</appendix>
<appendix>(+ Command,Control,Option+Keys to QWERTY)</appendix>
<identifier>remap.qwerty2programmerdvorak_qwerty</identifier>
<modifier_not>
ModifierFlag::COMMAND_L,
ModifierFlag::COMMAND_R,
ModifierFlag::CONTROL_L,
ModifierFlag::CONTROL_R,
<item>
<name>Remap Caps Lock to Hyper with Escape on tap</name>
<appendix>OS X doesn't have a Hyper. This maps caps lock (actually F19) to Control + Shift + Option + Command, unless you tap it. Then it sends Escape.</appendix>
<identifier>caps_lock_to_hyper_or_escape</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
@msolomon
msolomon / .slate
Created March 10, 2014 05:00
Slate configuration file
# Slate configuration file
# Be sure to customize! See https://github.com/jigish/slate#configuring-slate
### Aliases
## Key aliases
alias hyper ctrl;shift;alt;cmd
## Application aliases
@msolomon
msolomon / .zshrc
Last active June 12, 2019 20:31
File-searching aliases
function f() { find . -iname "*$1*" ${@:2} }
function r() { grep "$1" ${@:2} -R . }
# Better: use the silver searcher (brew install the_silver_searcher)
alias f="ag -g"
alias r=ag
# Best: use ripgrep (brew install ripgrep)
alias r=rg
<item>
<name>Remap Caps Lock to Hyper</name>
<appendix>OS X doesn't have a Hyper. This maps caps lock (actually F19) to Control + Shift + Option + Command.</appendix>
<identifier>caps_lock_to_hyper</identifier>
<autogen>
--KeyToKey--
KeyCode::F19,
@msolomon
msolomon / ScoreKeeper.py
Created December 6, 2012 23:02
score keeping interview problem
# Mike Solomon
class ScoreKeeper(object):
def __init__(self):
self.scores = [0] * 100
self.total = 0 # total scores inserted
self.curr_median = None # current value of median
self.curr_left_of = 0 # number of scores inserted < current median
self.curr_right_of = 0 # number of scores inserted > current median
def submit(self, score):
@msolomon
msolomon / CirclePacker.py
Created December 3, 2012 19:09
MindSnacks engineering challenge 2
#!/usr/bin/python -O
# Mike Solomon
# 2 Dec 2012
# MindSnacks engineering challenge 2
# usage: CirclePacker.py test_case_file
import math, copy, sys
class PackedCircle(object):