Skip to content

Instantly share code, notes, and snippets.

@macro
macro / observer.md
Created November 3, 2015 18:05 — forked from pnc/observer.md
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
@macro
macro / eject_tm_disk
Created April 23, 2015 18:52
Simple bash script to stop time machine backup and eject the disk (assumes time machine disk is disk id 3)
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
ts () {
echo "$(python -c 'import datetime; print datetime.datetime.now().isoformat()')"
}
@macro
macro / trap_example.sh
Created June 18, 2013 19:18
A example bash script trapping UNIX IPC signals.
#!/bin/bash
trap shutdown EXIT SIGINT SIGQUIT SIGTERM
function shutdown()
{
echo -e "Shutting down ..."
exit 0
}
@macro
macro / gist:5118730
Last active December 14, 2015 16:59
find top 20 registered pids w/ largest msg queues
lists:sublist(lists:reverse(lists:keysort(3, [{N,P,MQ} || N <- registered(), P <- [whereis(N)], is_pid(P), {_, MQ} <- [erlang:process_info(P, message_queue_len)]])), 20).
@macro
macro / ejabberd_
Created October 23, 2012 01:44 — forked from groupdock/ejabberd_
ejabberd munin plugin
#!/bin/bash
#
# Updated/Modified by Luc Castera (2010-06-14). Intellum Inc.
# (http://www.intellum.com)
#
# Munin plugin for ejabberd2.
#
# Written by Lasse Karstensen <lkarsten@hyse.org> 2007-05-27.
# Based on ejabberd-plugin by Christian Dröge <Christian@draugr.de>
#
@macro
macro / redis_sessions.py
Created May 25, 2011 04:33 — forked from ericflo/redis_sessions.py
A Redis-based Django session store.
import simplejson
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django_ext.redis_helper import get_redis
class SessionStore(SessionBase):
"""
A Redis-based session store.