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
(defcustom nrepl-use-local-resources t | |
"use local resources under HOME if possible." | |
:type 'string | |
:group 'nrepl) | |
(defun nrepl-tramp-prefix () | |
"use buffer-file-name on jump-origin to determine if the buffer is opened on a remote server. | |
M-. will have put the jump-origin on the tag-marker-ring, so we get the info there." | |
(save-match-data | |
(let ((jump-origin (buffer-file-name (marker-buffer (ring-ref find-tag-marker-ring 0))))) |
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
;; naïve implementation | |
(defmulti bits type) | |
(defmethod bits Long [number] | |
(concat | |
(repeat (Long/numberOfLeadingZeros number) 0) | |
(if (not (zero? number)) | |
(->> (Long/toBinaryString number) (map #(Integer/valueOf (str %))))))) | |
(defmethod bits Integer [number] | |
(concat |
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 scratch.mapping) | |
(defstruct Book :title :author :publisher) | |
(defstruct Author :firstName :lastName) | |
(defstruct Publisher :name) | |
(def books [(struct Book | |
"The Reality Dysfunction" | |
(struct Author "Peter F." "Hamilton") | |
(struct Publisher "Pan Books")) |
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
##echo "emacsclient" | |
### cygwin magic | |
## new-frame - make a new emacs frame | |
## edit-new-frame file - edit file in new emacs frame | |
## edit file - edit file in existing emacs frame | |
# http://www.emacswiki.org/emacs/EmacsClient | |
function new-frame() { |
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
;; ~/.emacs.d/elisp | |
;; ~/.emacs.d/package.el | |
;; ln -s ~/.emacs.d/elisp/init.el ~/.emacs.d/init.el | |
(and (= emacs-major-version 23) | |
(defun server-ensure-safe-dir (dir) "Noop" t)) | |
;; (getenv "APPDATA") | |
;; (getenv "HOME") | |
;;(and (= emacs-major-version 23) | |
;; (add-to-list 'load-path (getenv "APPDATA")) |
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
sub untaint { | |
my $data = shift; | |
return $data if !$data; | |
if ($data =~ /^([-\@\w\d\/\.]+)\r*$/) { | |
$data = $1; # $data now untainted | |
} else { | |
die "Tainted data in $data\n"; # log this somewhere | |
} | |
return $data; | |
} |
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
./split_destination-test.sh | |
destination user@host.with.full.domain:/full/path/to/install/package.ext | |
server host.with.full.domain | |
servershort host | |
user user | |
fullpath /full/path/to/install/package.ext | |
path /full/path/to/install/ | |
package package.ext |
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
;; http://www.learndatalogtoday.org/ | |
;; Find movie titles made in 1985 | |
[:find ?title | |
:where | |
[?m :movie/year 1985] | |
[?m :movie/title ?title]] | |
;; What year was "Alien" released? | |
[:find ?year |
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
# -*- mode: sh -*- | |
# add the following line to .bash_profile | |
# . .bash_finder | |
## opens a standard file explorer window at the current location | |
## e - just a window at current location | |
function e { | |
if [ $# -eq 0 ]; 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
(ns sandbox.fof | |
(:require [net.cgrand.enlive-html :as html])) | |
(defn fetch-url [url] | |
(html/html-resource (java.net.URL. url))) | |
(def nom (fetch-url "http://www.asp.fof.dk/aaretsunderviser.asp#.Ulvs8RbNdcx")) | |
(defn parse [nom] | |
(map #(vector % 1) (map html/text (html/select nom [:b])))) |