This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'clojure-mode "clojure-mode" t) | |
(require 'slime t) | |
(when (eq system-type 'cygwin) | |
(add-hook 'slime-connected-hook (lambda () | |
(setq slime-to-lisp-filename-function (lambda (filename) | |
(replace-regexp-in-string | |
"\n" "" (shell-command-to-string | |
(format "cygpath.exe --windows %s" filename)))) | |
slime-from-lisp-filename-function (lambda (filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'cl) | |
(defun rotate-left (l) (append (cdr l) (list (car l)))) | |
(defun rotate-windows () | |
(let ((start-positions (rotate-left (mapcar 'window-start (window-list)))) | |
(buffers (rotate-left (mapcar 'window-buffer (window-list))))) | |
(mapcar* (lambda (window buffer pos) | |
(set-window-buffer window buffer) | |
(set-window-start window pos)) | |
(window-list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun reopen-sudo () | |
(interactive) | |
(unless (file-remote-p (buffer-file-name)) | |
(find-file (tramp-make-tramp-file-name "sudo" "root" "localhost" (buffer-file-name))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(set! *unchecked-math* true) | |
(defmacro iloop [[b t n] & body] | |
`(loop [~@b] | |
(when ~t | |
~@body | |
(recur ~n)))) | |
(defn count-primes [^long n] | |
(let [c (inc n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ORIG_MVN=/opt/maven/bin/mvn | |
while [ ! -r "pom.xml" ] && [ "$PWD" != "/" ] | |
do | |
cd .. | |
done | |
if [ -r "pom.xml" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar swank-autoconnect-port 4005) | |
(defvar swank-autoconnect-timer nil) | |
(defun swank--listeningp () | |
(ignore-errors | |
(let ((p (open-network-stream "SLIME Lisp Connection Test" nil "localhost" swank-autoconnect-port))) | |
(when p | |
(delete-process p) | |
t)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LocalCommand echo -ne "\033]0;"%r@%h"\007" | |
PermitLocalCommand yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns #^{:author "Jürgen Hötzel", | |
:doc "Message Digest function for Clojure | |
Usage | |
(require 'md) | |
MD5 Checksum String: | |
(md/digest-str (md/sum \"MD5\" \"/etc/passwd\")) | |
\"85dbcf75fa3eb92335cc3ac47dfa64c9\""} | |
md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defadvice shell-cd (after shell-dirtrack-update-buffer-name activate) | |
(let* ((new-name (generate-new-buffer-name "*shell*")) | |
(old-name (generate-new-buffer-name (buffer-name)))) | |
(unless (string= new-name old-name) | |
(rename-buffer new-name)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sicp.queens) | |
(def empty-board '()) | |
(defn safe? | |
"Check if queen in last row is safe" | |
[positions] | |
(let [[queen-pos & left] positions | |
k (count positions) | |
diags-up (map - left (range 1 (inc k))) |