Skip to content

Instantly share code, notes, and snippets.

View ihodes's full-sized avatar

Isaac Hodes ihodes

View GitHub Profile
@ihodes
ihodes / reversi-move-valid.clj
Created May 1, 2012 00:10 — forked from mistercam/reversi-move-valid.clj
A function to determine if a move in Reversi is valid
(def directions
{:N [-1 0] :NE [-1 1] :E [0 1] :SE [1 1] :S [1 0] :SW [1 -1] :W [0 -1] :NW [-1 -1]})
(defn move-valid? [board piece move]
"Returns true if the specified move for the specified piece will cause
a piece to be flipped in any direction."
(let [r (move 0) c (move 1)]
(cond
(or (> r 7) (< r 0) (> c 7) (< c 0)) nil
(not= nil ((board r) c)) nil
@ihodes
ihodes / autotree.py
Created April 5, 2013 02:12
Handy hacky script to help me reorganize a flask project
import envoy, time, os
def main():
old = ""
time.sleep(1)
while True:
new_run = envoy.run("tree -I \"init|*.pyc|*html\" --noreport -L 3 -F")
new = new_run.std_out
if old != new:
envoy.run('clear')
# fix copy-paste in OSX
set-option -g default-command "reattach-to-user-namespace -l bash"
set -g prefix C-z
unbind C-b
bind C-z send-prefix
set -g status on
set -g status-keys emacs
set -g status-bg black
export PS1="\w ☞ "
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export EDITOR="emacs"
alias l="ls -aG"
alias ll="ls -alG"
alias ..="cd .."
alias k="kill"
alias e="emacs"
(add-to-list 'load-path "~/.emacs.d")
(require 'better-defaults)
(require 'ensure-packages)
(require 'bindings)
(dolist (x '(scheme emacs-lisp lisp clojure))
(when window-system
(font-lock-add-keywords
;; much stolen from github.com/technomancy/better-defaults
(load-theme 'tango-dark)
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
(global-set-key (kbd "C-M-s") 'isearch-forward)
(global-set-key (kbd "C-M-r") 'isearch-backward)
(global-set-key (kbd "C-c r") 'replace-string)
(defvar packages
'(gist clojure-mode coffee-mode auctex
haml-mode haskell-mode inf-ruby
magit magithub markdown-mode paredit python
sass-mode rainbow-mode scss-mode
yaml-mode undo-tree)
"Packages that should always be installed.")
(dolist (p packages)
(when (not (package-installed-p p))
######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE
#
# Version 11.0.1
# $Date: 2000/03/02 15:51:11 $
# terminfo syntax
#
# Eric S. Raymond (current maintainer)
# John Kunze, Berkeley
# Craig Leres, Berkeley
#
~ > dig pinboard.in
; <<>> DiG 9.8.3-P1 <<>> pinboard.in
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27447
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;pinboard.in. IN A