Skip to content

Instantly share code, notes, and snippets.

@greneholt
greneholt / .gitconfig
Last active August 4, 2017 00:06
Git config
[alias]
ci = commit
cia = commit --amend
cian = commit --amend --no-edit
st = status
pl = pull
cp = cherry-pick
cps = cherry-pick --strategy=subtree -x
co = checkout
df = diff
@greneholt
greneholt / AutoHotkey.ahk
Last active September 14, 2020 20:35
AutoHotkey semicolon arrow keys and capslock to ctrl/escape
#SingleInstance force
; Necessary for semicolon arrow to work, since it can send semicolon.
#InstallKeybdHook
; Better performance.
SendMode Input
; Kill CapsLock.
SetCapsLockState AlwaysOff
@greneholt
greneholt / Random.jack
Created March 27, 2012 03:35
Jack pseudorandom number generator
/*
Random Number Generator
Original author: Taylor Wacker
Modified by: Connor McKay
This is a pseudo random number generator that uses the
Linear Congruential Generator (LCG) to generate random
numbers.
*/
class Random {
@greneholt
greneholt / private.xml
Last active October 2, 2015 00:17
Semicolon home row arrow mode and keyboard flip with KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>Home Row Arrow Mode</name>
<list>
<item>
<name>What's "Home Row Arrow Mode"?</name>
<appendix>Single Key Press Semicolon turns on "Home Row Arrow Mode"</appendix>
<appendix>Then you can use JKIL as Left/Down/Up/Right.</appendix>
<appendix>Also, U = home, O = end, H = page up, and N = page down.</appendix>
@greneholt
greneholt / vmtranslator.rb
Created February 29, 2012 21:52
File IO for vm translator
begin
raise VMTranslatorError.new("Only enter the name of one .vm file or the name of a directory") if ARGV.length > 1
raise VMTranslatorError.new("File does not exist") unless File.exists?(ARGV.first)
if File.directory? ARGV.first
files = Dir.glob(File.join(ARGV.first, '*.vm'))
raise VMTranslatorError.new("No .vm files in #{ARGV.first}") unless files.length > 0
outfile = File.join(ARGV.first, File.basename(ARGV.first))
else
raise VMTranslatorError.new("Not a .vm file") unless ARGV.first =~ /\A(.+)\.vm\Z/i
@greneholt
greneholt / hack_c_instr
Created February 21, 2012 09:11
Hack assembly C instruction regex
\A
(?:(?=[AMD])(A?M?D?)=)? # destination
(
[AMD][+\-&|][AMD1] | # binary operations
[\-!]?[AMD01] # unary operations
)
(?:;J([GL][ET]|EQ|NE|MP))? # jump
\Z