Skip to content

Instantly share code, notes, and snippets.

View bryanhunter's full-sized avatar

Bryan Hunter bryanhunter

View GitHub Profile
@bryanhunter
bryanhunter / build-erlang-r15b01.sh
Created July 23, 2012 05:00
Build Erlang R15B01 (tested on a fresh Ubuntu 12.04 box)
#!/bin/bash
# Pull this file dowm, make it executable and run it with sudo
# wget https://raw.github.com/gist/3162027/build-erlang-r15b01.sh
# chmod u+x build-erlang-r15b01.sh
# sudo ./build-erlang-r15b01.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
@bryanhunter
bryanhunter / about.txt
Created August 8, 2012 17:20
Testing idea of using sum of card numbers as security question
Based on Twitter conversation with @b6n
*Question 1*
The digits in the credit card pattern 4811 XXXX XXXX 2632 sum to 77, what are the
middle 8?There are 112,400 card numbers (about 1.2%) in this range that 1) pass
the luhn check and 2) sum to 77. The credit card isn't in great danger.
*Question 2*Does the sum of the card digits make a good security question for
phone support?The first hurdle is having a customer add the 16 digits without
miss-adding or freaking out. Next, the numbers do cluster to the middle. A bad
@bryanhunter
bryanhunter / abcast.md
Created September 27, 2012 20:49
What is the "abcast" returned by the Erlang BIF c:nl(Module)?

Example

nl(Blabber).
abcast

What's being called?

@bryanhunter
bryanhunter / virdings-rule.md
Created October 26, 2012 19:28
Virding's First Rule of Programming

Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.

@bryanhunter
bryanhunter / build-erlang-r15b03.sh
Last active October 13, 2015 07:58
Build Erlang R15B03 on Ubuntu
#!/bin/bash
# Pull this file dowm, make it executable and run it with sudo
# wget https://raw.github.com/gist/4164394/build-erlang-r15b03.sh
# chmod u+x build-erlang-r15b03.sh
# sudo ./build-erlang-r15b03.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
@bryanhunter
bryanhunter / r15b03-on-raspbian1212.sh
Last active May 20, 2017 11:29
Builds Erlang R15B03 from source on the Raspberry Pi. Tested on the 2012-12-16 build of Raspbian (Wheezy)
#!/bin/bash
# Pull this file dowm, make it executable and run it with sudo
# wget https://gist.github.com/raw/4361444/r15b03-on-raspbian1212.sh
# chmod u+x r15b03-on-raspbian1212.sh
# sudo ./r15b03-on-raspbian1212.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
@bryanhunter
bryanhunter / DumpToExcel.cs
Created January 25, 2013 16:19
Painless way to build Microsoft Excel spreadsheets from any IEnumerable<T>. Does not require Excel.
using System.Collections.Generic;
using System.IO;
using OfficeOpenXml; // (EPPLus - http://epplus.codeplex.com/)
namespace OfficeReports
{
public static class DumpToExcel
{
public static void Dump<T>(IEnumerable<T> data, string outputFilename)
{
@bryanhunter
bryanhunter / build-erlang-r16b.sh
Created April 30, 2013 09:26
Build Erlang R16B on Ubuntu
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://raw.github.com/gist/5487621/build-erlang-r16b.sh
# chmod u+x build-erlang-r16b.sh
# sudo ./build-erlang-r16b.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
@bryanhunter
bryanhunter / cqrs-with-erlang-abstract.md
Last active December 17, 2015 11:59
"CQRS with Erlang" abstract for the Strange Loop (2013)

CQRS with Erlang

Erlang an industry-proven functional programming language that simplifies writing reliable, concurrent, distributed systems.

CQRS is an architectural pattern that separates commands (which mutate state) from queries (which return values). With CQRS the “read” data store and the “write” data store can be on different severs, can use different storage engines, and can be scaled independently. CQRS is often linked with the Event Sourcing pattern which models state as a series of events (past tense verbs) rather than a single “latest” value. What works for an accountant’s ledger and for Git can work for our “write” store too. Given a series of events we can deal with concurrency and collisions more intelligently than “last guy wins”. We can also define varied service level agreements for commands and queries.

CQRS promotes distribution, concurrency and eventual consistency which is dandy until we attempt to code an implementation with conventional tools like C# or Java. Lucky for us Erlang i

@bryanhunter
bryanhunter / 2013-06-24.Congress.txt
Created June 24, 2013 16:48
Letter to Congress about Edward Snowden's NSA revelations and the PATRIOT Act
Dear Congressman:
The NSA programs and activities recently disclosed by the whistleblower Edward Snowden are in clear violation of the Fourth Amendment. Despite the fear and mad scramble for security, our constitution was not amended by 9/11, by Osama bin Laden, or by the PATRIOT Act. The Constitution is still the supreme law, and each federal official has sworn to uphold the Constitution including the Fourth Amendment.
If we are in fear of terrorism, the terrorist win. If we allow terrorists to diminish our liberties or to alter our way of life, the terrorists win. I personally have no fear of terrorists. Statistically cars and fatty foods are scary, but terrorists are not. I am, however, afraid of the fear-mongers in Congress. I am afraid they are horse-trading our liberty for our security. I am afraid they are creating a nation of cowards. I am afraid America is becoming precisely what it long struggled against during the Cold War.
The PATRIOT Act has been steadily rotting the foundations of our Republi