Skip to content

Instantly share code, notes, and snippets.

@owainlewis
owainlewis / hipchat.el
Created May 8, 2013 10:58
HipChat Jabber Emacs
;; HipChat
(setq ssl-program-name "gnutls-cli"
ssl-program-arguments '("--insecure" "-p" service host)
ssl-certificate-verification-policy 1)
;; Connect using jabber.el
;; M-x jabber-connect <RET>
;; Config
@jsmorph
jsmorph / clj1152.clj
Last active December 25, 2015 21:19
Ugly mitigation of CLJ-1152 (PermGen) bugs in the protocols case
;; Ugly mitigation of http://dev.clojure.org/jira/browse/CLJ-1152 in
;; the protocols case. Motivation: Need to eval lots domain-specific
;; language code rendered in core.logic. Approach: Start a thread to
;; purge protocol caches every second. You should probable write a
;; fancier version.
(defn protocol? [x]
(and (instance? clojure.lang.PersistentArrayMap x)
(boolean (:on-interface x))))
@gfredericks
gfredericks / with-local-redefs.clj
Last active November 30, 2022 15:30
thread-local version of with-redefs
(defn with-local-redefs-fn
[a-var its-new-value func]
(cast clojure.lang.IFn @a-var)
(alter-meta! a-var
(fn [m]
(if (::scope-count m)
(update-in m [::scope-count] inc)
(assoc m
::scope-count 1
::thread-local-var (doto (clojure.lang.Var/create @a-var)
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent
@jwinder
jwinder / gist:8522372
Created January 20, 2014 15:45
hipchat.el
(require 'mine-jabber)
;; Username & nickname fields from https://banno.hipchat.com/account/xmpp
(setq hipchat-username "")
(setq hipchat-nickname "")
(setq hipchat-password "")
(setq hipchat-autojoin-rooms
'("aggregation" "assets" "banno_talk" "banno_cms" "data_services" "emacs" "grip" "kernel" "southen" "troll_talk" "webdev" "design_talk"))

λ-calculus Bonus Material!

Credit where it’s due

The author of the talk I gave yesterday at PyTennessee is Jim Blandy. Jim is a Mozilla engineer, a go player, a drinker of tea, and one of the most generous people I’ve ever met.

Bits and pieces

  • Are the Church numerals 32-bit integers? Or 64-bit integers? Or do they go on forever?
require 'set'
GEM_FILE_TO_PROCESS = "Gemfile.lock"
def gem_list_finished?(line)
line.include?("PLATFORMS")
end
def non_gem_line?(line)
line.include?("GEM") ||
#!/bin/bash
set -eu
shopt -s nullglob
readonly base_dir=/var/local/docker-registry
readonly output_dir=$(mktemp -d -t trace-images-XXXX)
readonly jq=/tmp/jq
readonly repository_dir=$base_dir/repositories
@bjaglin
bjaglin / remove-orphan-images.sh
Last active March 31, 2024 22:54
Remove orphan layers left by the "file" storage backend of the docker registry, heavily inspired by https://gist.github.com/shepmaster/53939af82a51e3aa0cd6
#!/bin/bash
set -eu
shopt -s nullglob
readonly base_dir=/var/lib/docker/registry
readonly output_dir=$(mktemp -d -t trace-images-XXXX)
readonly jq=/usr/bin/jq
readonly repository_dir=$base_dir/repositories
@staltz
staltz / introrx.md
Last active June 8, 2025 22:15
The introduction to Reactive Programming you've been missing