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
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 https://raw.githubusercontent.com/timmc/abp/master/lj.txt
!
livejournal.com##.rutos
livejournal.com##.b-fader
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
View jwt-sign-ES256.sh
#!/bin/bash
# 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
timmc / bisect.sh
Last active Jan 20, 2017
bisect and lein template
View bisect.sh
#!/bin/bash
cd ./PATH/TO/PROJECT/BASE
export LEIN_FAST_TRAMPOLINE=true
lein clean
lein trampoline compile || {
echo "Build failed."
exit 125
}
@timmc
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
View port-forwarding-jmx.md

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 -Dcom.sun.management.jmxremote.port=50004 -Dcom.sun.management.jmxremote.rmi.port=50005 -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -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
(ns adhoc.java-types
"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
characters"
(:require [clojure.java.io :as io]
[clojure.string :as str])
(:import java.io.File
@timmc
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)
$.ajax({
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/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.