Skip to content

Instantly share code, notes, and snippets.

View binarytemple's full-sized avatar

Bryan Hunt binarytemple

  • The mountains of mourne
View GitHub Profile
@binarytemple
binarytemple / elixir.diagnostics.markdown
Last active February 1, 2022 20:48
Generate a list of all processes in the system which are neither linked nor monitored.

Inspired by Stuff Goes Bad - Erlang in Anger

Is the global process count indicative of a leak? If so, you may need to investigate unlinked processes, or peek inside supervisors’ children lists to see what may be weird-looking.

defmodule Diags do 

  @doc """
@binarytemple
binarytemple / sourceforge.to.github.impor.markdown
Created April 27, 2015 09:05
import a sourceforge project (with full history) to github

In order to clone the TVN application from sourceforge to github I performed the following steps.

rsync -av rsync://tnv.cvs.sourceforge.net/cvsroot/tnv/* .
svn export --username=guest http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
cp ./cvs2svn-trunk/cvs2git-example.options ./cvs2git.options
vim cvs2git.options
cvs2svn-trunk/cvs2git --options=cvs2git.options --fallback-encoding utf-8
git@github.com:binarytemple/tnv.git tnv-github
git clone git@github.com:binarytemple/tnv.git tnv-github
#!/bin/bash
SOURCE=/tmp/int.erl
COMPILED=/tmp/int.beam
test -e $SOURCE || curl https://raw.githubusercontent.com/josevalim/otp/c7e82c6b406b632a191c791a1bd2162bde08f692/lib/debugger/src/int.erl > $SOURCE
erlc -o ${COMPILED%int.beam} $SOURCE
chmod 444 $COMPILED
chgrp admin $COMPILED
#!/bin/bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install asdf
ASDF_CONF=$(
cat <<EOF
export ASDF_DIR="$(brew --prefix asdf)"
. ${ASDF_DIR}/asdf.sh
@binarytemple
binarytemple / utility.md
Last active April 29, 2020 10:34
Erlang decompiler I found on the web, works for Elixir beam files too

DON'T BOTHER USING - BROKE CODE

%% Author: PCHAPIER
%% Created: 25 mai 2010
-module(utility).

%%
%% Include files
%%
@binarytemple
binarytemple / b2f.erl
Created April 29, 2020 10:32 — forked from kevsmith/b2f.erl
Erlang/Elixir BEAM decompiler
#! /usr/bin/env escript
%% -*- mode: erlang -*-
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%%
%% Copyright 2016 Operable, Inc. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
@binarytemple
binarytemple / dynamic_dns_updater.py
Last active February 22, 2019 04:19
Route 53 dyndns zone updating script taken from Taylor Burnham post
#!/usr/bin/python
# route 53 dyndns script taken from Taylor Burnhams original post :
# https://www.vnucleus.com/blog/2014/6/15/4-using-amazon-route53-for-dynamic-dns
# modified to perform UPSERT rather than DELETE,CREATE
# modified to use a configuration file /etc/dyndns.config to store config values
import boto
from boto.route53.record import ResourceRecordSets
import urllib2
@binarytemple
binarytemple / force_remove_s3_bucket.erl
Created October 17, 2017 10:22 — forked from angrycub/force_remove_s3_bucket.erl
Snippet to forcibly remove a CS Bucket from a Riak CS User
Force_remove_s3_bucket = fun(UserID, Bucket) ->
Update_user_buckets = fun(User, Bucket) ->
Buckets = User#rcs_user_v2.buckets,
%% At this point any siblings from the read of the
%% user record have been resolved so the user bucket
%% list should have 0 or 1 buckets that share a name
%% with `Bucket'.
case [B || B <- Buckets, B#moss_bucket_v1.name =:= Bucket#moss_bucket_v1.name] of
[] ->
{ok, User#rcs_user_v2{buckets=[Bucket | Buckets]}};
@binarytemple
binarytemple / README.md
Created July 1, 2016 23:13 — forked from rbishop/README.md
A super simple Elixir server for sending Server Sent Events to the browser.

Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:

  defp deps do
    [
      {:cowboy, "~> 1.0.0"},
      {:plug, "~> 0.8.1"}
    ]
  end