Skip to content

Instantly share code, notes, and snippets.

@chrismccord
chrismccord / install.sh
Created Jul 27, 2016 — forked from chaos-ad/install.sh
Installing erlang in ubuntu
View install.sh
#!/bin/bash
# installing erlang on ubuntu's
VERSION="R15B01"
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev
sudo mkdir -p /opt/erlang/
curl -O https://raw.github.com/spawngrid/kerl/master/kerl && chmod a+x kerl
sudo mv kerl /opt/erlang/
@chrismccord
chrismccord / drain_stop.ex
Created May 27, 2016 — forked from aaronjensen/drain_stop.ex
Phoenix Drain Stop
View drain_stop.ex
defmodule DrainStop do
@moduledoc """
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown
occurs. It first shuts down the acceptor, ensuring that no new requests can be
made. It then waits for all pending requests to complete. If the timeout
expires before this happens, it stops waiting, allowing the supervision tree
to continue its shutdown order.
DrainStop should be installed in your supervision tree *after* the
EndPoint it is going to drain stop.
@chrismccord
chrismccord / 1.js
Created Apr 7, 2016 — forked from net/1.js
Adding Bootstrap to Phoenix using NPM
View 1.js
// 1. Add Bootstrap as a dependency in package.json
{
...
"dependencies": {
...
"bootstrap": "~3.3.6"
}
}
@chrismccord
chrismccord / phoenix showdown rackspace onmetal io.md
Created Nov 17, 2015 — forked from omnibs/phoenix showdown rackspace onmetal io.md
Phoenix Showdown Comparative Benchmarks @ Rackspace
View phoenix showdown rackspace onmetal io.md

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@chrismccord
chrismccord / observer.md
Created Nov 3, 2015 — forked from pnc/observer.md
Using Erlang observer/appmon remotely
View observer.md

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
@chrismccord
chrismccord / postgres-upgrade-recipe.sh
Created Oct 6, 2015 — forked from eoinkelly/postgres-upgrade-recipe.sh
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
View postgres-upgrade-recipe.sh
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
View client.js
var socket = new Phoenix.Socket(PewMiddle.config.socketPath);
PewMiddle.requestGame = function(username, callback) {
socket.join(PewMiddle.config.channel, "lobby", {username: username}, function(channel) {
var player = null;
channel.on("player:created", function(message) {
player = message;
});
channel.on("game:created", function(game) {
callback(game.id, player);
View gist:5301821
# remove any bad refs
git remote prune origin
# pipe into bash and auto-delete any branches that have been merged into master!
git log master --pretty=format:'%d' | grep '^ (origin' | tr -d ' ()' | sed 's/origin\//git push origin :/'
@chrismccord
chrismccord / gist:1507045
Created Dec 21, 2011 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
View gist:1507045

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt