Skip to content

Instantly share code, notes, and snippets.

Tim McCormack timmc

Block or report user

Report or block timmc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
timmc / gist:1c3fa7504f8abba5f7855e2acee83e5f
Last active Apr 5, 2017
Remove LJ user agreement modal - Adblock Plus filter list
View gist:1c3fa7504f8abba5f7855e2acee83e5f
[Adblock Plus 1.1]
! Remove LJ user agreement modal
! Expires: 2 days (update frequency)
! Moved to
View five.log
freenode/#clojure on 2014-04-21:
amalloy sets 5 to be 2 using reflection, probably in PM with clojurebot:
(let [field (nth (.getDeclaredFields Long) 3)] (.setAccessible field true) (.set field 5 2))
19:10 < amalloy> justin_smith: i think ''lovecraft should contain (alter-var-root #'defmacro (constantly (fn [& args] `(quote ~(rand-nth '#{various lovecraftian horrors|)))))
19:11 < justin_smith> ouch
19:11 < amalloy> or something like it, anyawy
19:11 < justin_smith> yeah
# Create and sign a JWT token with ES256 given the path to an ECDSA
# private key and a JSON payload.
# $0 path/to/keypair.der '{"JSON": "payload"}'
# Example keypair creation:
# openssl ecparam -name prime256v1 -genkey -noout -outform DER > example-keypair.der
# A few tips for generating the payload:
# - Pipe raw strings through `jq --raw-input .` to encode them as
timmc /
Last active Jan 20, 2017
bisect and lein template
lein clean
lein trampoline compile || {
echo "Build failed."
exit 125
timmc / o-sc-reduce.clj
Last active Dec 19, 2016
Short-circuiting reduce with RxJava
View o-sc-reduce.clj
(require '[rx.lang.clojure.core :as rx])
(defn o-sc-reduce
"Perform a short-circuiting reduce on a series of Observables.
Reduces the series of Observables using the reduction function `f`,
starting the accumulator with `init`. Inputs to the reduction are
provided by subscribing to the input Observables serially, similar to
concat. If at any point (including the initial value) the accumulator
satisfies `final?`, emit the accumulator, complete, and do not

Port-forwarding JMX

Proof of concept:

  • Terminal 1:
    • SSH to remote host
    • Start a Java process with JMX registry port 50004, RMI callback port 50005, and RMI hostname pinned to localhost: java -Djava.rmi.server.hostname=localhost -cp /some/jar/file main.class
  • Terminal 2:
View gist:cbf503895f08dc39f3bc471aaa5e068a
Have the following been addressed in the branch, if appropriate?
- Tests (unit, API, integration)
- Docs (both in source and in docs directory, and in public docs if separate)
- Changelog
- Compatibility with previous versions (calls, shared files or DBs, data formats -- backward and forward compatibility)
- Rollback friendly?
- Feature switches?
View java-count-type-chars.clj
"Count the amount of space taken up by types in Java code. Problems:
- Not actually a parser! Counts contents of comments!
- Willovercount in code that is heavy in STATIC_FIELDS
- Doesn't capture generics, arrays, and other non-alphabetic type
(:require [ :as io]
[clojure.string :as str])
timmc / Deleting reddit comments.js
Last active Aug 6, 2016
Script to delete all reddit comments on the *current page* when viewing own comment history. Quick and dirty approach if you don't have more than a few hundred comments.
View Deleting reddit comments.js
function deleteAllOnPage(comments, index) {
var id = comments[index]
if (!id) return
console.debug('wiping ' + id)
type: 'POST',
url: '/api/editusertext',
data: {
thing_id: id,
View service name generator.clj
;; I needed some lorem ipsum names for a graph of microservices...
user=> (def words (set (clojure.string/split-lines (slurp "/usr/share/dict/words"))))
user=> (keep #(words (str % (last %) "er")) words)
("skipper" "stopper" "bragger" "glummer" "mapper" "tranquiller" "banner" "nipper" "clapper" "rubber" "chipper" "eavesdropper" "robber" "scatter" "madder" "canvasser" "supper" "carpetbagger" "beginner" "cheerfuller" "glibber" "snapper" "trimmer" "fitter" "pettifogger" "blotter" "patter" "transmitter" "plummer" "adder" "offer" "carefuller" "primmer" "cropper" "upper" "woodcutter" "shimmer" "bitter" "spotter" "potter" "tipper" "spitefuller" "putter" "clipper" "eviller" "drabber" "cotter" "mugger" "jabber" "traveller" "jobber" "gunner" "summer" "better" "shutter" "miller" "chatter" "hotter" "slammer" "chiseller" "jogger" "flatter" "pepper" "loyaller" "matter" "stirrer" "hopper" "runner" "hipper" "flipper" "funner" "dunner" "Donner" "ripper" "totter" "logger" "wrapper" "swimmer" "dipper" "mummer" "h
You can’t perform that action at this time.