Skip to content

Instantly share code, notes, and snippets.

View tmandry's full-sized avatar

Tyler Mandry tmandry

View GitHub Profile
@tmandry
tmandry / windowTracker.lua
Created December 21, 2014 08:30
Track all window open, close, move, and resize events using Hammerspoon
local events = hs.uielement.watcher
watchers = {}
function init()
appsWatcher = hs.application.watcher.new(handleGlobalAppEvent)
appsWatcher:start()
-- Watch any apps that already exist
local apps = hs.application.runningApplications()
@tmandry
tmandry / .phoenix.js
Created May 18, 2014 23:48
i3-like Phoenix configuration: focusing, fullscreen, marks
// Move windows between monitors, taken from jakemcc's config
function moveToScreen(win, screen) {
if (!screen) {
return;
}
var frame = win.frame();
var oldScreenRect = win.screen().frameWithoutDockOrMenu();
var newScreenRect = screen.frameWithoutDockOrMenu();
@tmandry
tmandry / bfs.pro
Last active April 12, 2020 20:01
Prolog Breadth First Search
% Breadth-first search with a list of possible destinations (picks the closest first.)
bfs(Dests, [[Target,Path,Cost]|_], Target, Path, Cost):- member(Target, Dests).
bfs(Dests, [[N,P,C]|Queue], Target, Path, Cost):-
setof([Child,Pp,Cp], child(N, P, C, Child, Pp, Cp), Children),
append(Queue, Children, NextQueue),
bfs(Dests, NextQueue, Target, Path, Cost).
child(N0, P0, C0, N, P, C):-
arc(N0, N, Len),
append(P0, [N], P),
C is C0 + Len.
@tmandry
tmandry / configure.diff
Created April 22, 2013 04:31
Getting the octave-forge java package (v1.2.9) to install on OS X Lion. See below for instructions and more information.
--- /tmp/java/src/configure 2012-07-25 11:34:49.000000000 -0500
+++ configure 2013-04-21 22:56:40.000000000 -0500
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65.
#
@@ -3252,9 +3252,10 @@
java_version=`$JAVA -version 2>&1 | sed -n -e 's/^java version[^0-9"]*"\([^"]*\)"/\1/p'`