Skip to content

Instantly share code, notes, and snippets.

View tavisrudd's full-sized avatar

Tavis Rudd tavisrudd

View GitHub Profile
#!/bin/bash
$(dirname $0)/bootstrap-portage.sh
# keyword chef and dependencies
cat <<EOF > /etc/portage/package.keywords/chef
=app-admin/chef-0.9.8
=dev-ruby/abstract-1.0.0
=dev-ruby/bunny-0.6.0
=dev-ruby/erubis-2.6.5
@tavisrudd
tavisrudd / gist:1152679
Created August 17, 2011 21:24 — forked from rlm/gist:746185
curry.clj
(ns sunil.curry)
(defn partial+
"Takes a function f and fewer than the normal arguments to f, and
returns a fn that takes a variable number of additional args. When
called, the returned function calls f with args + additional args.
differs from the core version in that it works on just one argument."
{:added "1.0"}
([f] f)
([f arg1]
@tavisrudd
tavisrudd / eterm-ssh
Created August 21, 2011 17:42
fuzzy completion search for gentoo ebuilds in elisp (using ido)
#!/bin/bash
# This is a wrapper around ssh so multi-term / emacs e-term will work
# well with remote shells.
term_name=$1
shift
screen -m -e^Uu -S $term_name /usr/bin/ssh $@
@tavisrudd
tavisrudd / readline_clipboard.sh
Created August 24, 2011 20:18
bash readline integration with clipboards: M-k = kill, M-y = yank, M-u = backwards kill
## derived from http://stackoverflow.com/questions/994563/integrate-readlines-kill-ring-and-the-x11-clipboard
## You need to choose which clipboard to integrate with, OS X or X11:
shell_copy() {
pbcopy # OS X
# or ssh user@remote_mac pbcopy
# or xclip
}
shell_yank() {
@tavisrudd
tavisrudd / jump_out_of_chrome_sandbox.js
Created August 26, 2011 20:40
notes on how to break out of chrome extension content script sandboxes and eval code in page context
// Chrome extension 'content scripts' run in a sandboxed 'isolated world'
// (http://code.google.com/chrome/extensions/content_scripts.html#execution-environment).
// However, there are ways to get out and execute js code in the page
// context. Google searching revealed the following ways:
////////////////////////////////////////////////////////////////////////////////
// http://blog.afterthedeadline.com/2010/05/14/how-to-jump-through-hoops-and-make-a-chrome-extension/
// it looks like jQuery must be loaded by the content-script
jQuery('body').append('<script type="text/javascript">(function(l) {
var res = document.createElement('SCRIPT');
@tavisrudd
tavisrudd / core.clj
Created October 31, 2011 17:10 — forked from tomykaira/core.clj
save your followers in neo4j
(ns friends-relationship-twitter.core
(:require [borneo.core :as neo]
twitter
[oauth.client :as oauth]))
(def oauth-consumer (oauth/make-consumer "KEY"
"SECRET"
"https://api.twitter.com/oauth/request_token"
"https://api.twitter.com/oauth/access_token"
"https://api.twitter.com/oauth/authorize"
@tavisrudd
tavisrudd / cljdoc.el
Created January 2, 2012 19:47 — forked from tomykaira/cljdoc.el
cljdoc.el --- eldoc mode for clojure
;;; cljdoc.el --- eldoc mode for clojure
;; Copyright (C) 2011 tomykaira
;; Version 0.1.0
;; Keywords: eldoc clojure
;; Author: tomykaira <tomykaira@gmail.com>
;; URL: https://gist.github.com/1386472
;; This file is not part of GNU Emacs.
@tavisrudd
tavisrudd / tmp.clj
Created January 9, 2012 21:20
debug version of eval-in-subprocess
(defn eval-in-subprocess [project form-string]
(let [command `(~(or (System/getenv "JAVA_CMD") "java")
"-cp" ~(get-classpath-string project)
~@(get-jvm-args project)
"clojure.main" "-e" ~form-string)]
(let [cp (get-classpath-string project)]
(println (type cp) ": " cp))
(println "---")
(let [args (get-jvm-args project)]
(println (type args) ": " args))
@tavisrudd
tavisrudd / defmethod.clj
Created January 19, 2012 22:13
add metadata to clojure multifn methods
(defmacro defmethod
"Creates and installs a new method of multimethod associated with dispatch-value. "
{:added "1.0"}
[multifn dispatch-val & fn-tail]
`(. ~(with-meta multifn {:tag 'clojure.lang.MultiFn}) addMethod ~dispatch-val (fn ~@fn-tail)))
(defmacro defmethod-with-metadata
"Creates and installs a new method of multimethod associated with dispatch-value. "
{:added "1.0"}
@tavisrudd
tavisrudd / cdt-locals.patch
Created January 20, 2012 03:37
very hackish patch for swank-clojure that adds locals (or at least a string version of them) support to cdt stack frames
diff --git a/src/swank/core/cdt_backends.clj b/src/swank/core/cdt_backends.clj
index 05257f2..5b984d0 100644
--- a/src/swank/core/cdt_backends.clj
+++ b/src/swank/core/cdt_backends.clj
@@ -1,6 +1,7 @@
(ns swank.core.cdt-backends
(:refer-clojure :exclude [next])
(:require [cdt.ui :as cdt]
+ [cdt.reval]
[swank.core.cdt-utils :as cutils]