Skip to content

Instantly share code, notes, and snippets.

View alanpeabody's full-sized avatar

Alan Peabody alanpeabody

View GitHub Profile
aaronjanse /
Created August 21, 2017 14:37
Magical command to make gpg work with YubiKey smartcard
killall gpg-agent && gpg-agent --daemon --use-standard-socket --pinentry-program /usr/local/bin/pinentry
nerdyworm /
Created July 30, 2016 17:40
rename a phoenix project
set -e
pnc /
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
joakimk /
Last active January 1, 2022 23:21
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.

simme / app.js
Last active May 16, 2019 05:59
Gulp file for an Ember project using bower and browserify.
View app.js
// Load Ember into the global scope by requiring it
// Go have fun
var app = Ember.Application.create();
xaviershay /
Last active December 24, 2015 20:49
SASS + Coffee + Concatenation in prod
set -exo pipefail
if [ `uname` == 'Darwin' ]; then
JSCOMPRESSOR="yuicompressor --type js"
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
for (var i = 0; i < document.styleSheets.length; i++) {
function countSheet(sheet) {
brendanhay /
Created February 8, 2012 14:15
Tmux, copy-mode, and OSX shenanigans.

Copy, with line wrapping!

If you've been trying to copy/paste text from a multi-pane tmux session with the mouse, you've probably been pretty pissed at the blissful ignorance a terminal application has of the rodent in your hand.

The alternative, which is quote-unqoute native copy/pasting using copy-mode takes a bit to get used to. So this is one solution for copying and pasting lines from a session with correct line wrapping behaviour, albeit keyboard only.


Since copy-mode has similar concepts of marks, regions, and temp buffers to Emacs .. you'll probably find it straight forward if you're familar with Emacsen. For people using vi-mode in tmux, the same still applies but obviously the default key bindings will differ alot from what I show below.

ato / debug.clj
Created December 9, 2009 11:42
Simpler debug-repl that works with unmodified Clojure
View debug.clj
;; Inspired by George Jahad's version:
(defmacro local-bindings
"Produces a map of the names of local bindings to their values."
(let [symbols (map key @clojure.lang.Compiler/LOCAL_ENV)]
(zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols)))
(declare *locals*)
(defn eval-with-locals