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-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 / 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 / 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 / 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 / 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 / TabSeparatedValueDataLoader.cs
Created June 13, 2012 23:00
Tab-separated Value data loader
public static class TabSeparatedValueDataLoader
{
public static IEnumerable<T> ParseTsv<T>(this string rawTabDeleimetedData, Func<string[], T> mapper)
{
IEnumerable<string[]> data = rawTabDeleimetedData.Split(new[] {'\r', '\n'},
StringSplitOptions.RemoveEmptyEntries)
.Select(x => x.Split(new[] {'\t'}, StringSplitOptions.None));
return data.Select(mapper);
}
@bryanhunter
bryanhunter / LeftJoinExtension.cs
Created May 10, 2012 04:23
Simplifies LINQ left joins
using System.Collections.Generic;
namespace System.Linq
{
public static class LeftJoinExtension
{
public static IEnumerable<TResult> LeftJoin<TLeft, TRight, TKey, TResult>(
this IEnumerable<TLeft> left,
IEnumerable<TRight> right,
Func<TLeft, TKey> leftKeySelector,
@bryanhunter
bryanhunter / erlang-memory.txt
Created March 30, 2012 23:23
Erlang memory usage
**ER15B 32-bit smp disabled**
Erlang R15B (erts-5.9) [async-threads:0]
Eshell V5.9 (abort with ^G)
1> Fun = fun() -> receive after infinity -> ok end end.
#Fun<erl_eval.20.111823515>
2> process_info(spawn(Fun), memory).
{memory,1308}
3>
@bryanhunter
bryanhunter / CaliburnMicroConventionsForActipro.cs
Created March 12, 2012 16:40
Caliburn.Micro conventions for Actipro controls
using ActiproSoftware.Windows.Controls.Ribbon.Controls;
using ActiproSoftware.Windows.Controls.Ribbon.Controls.Primitives;
using Caliburn.Micro;
namespace SampleApp
{
public static class CaliburnMicroConventionsForActipro
{
public static void AddConventions()
{
@bryanhunter
bryanhunter / oo-banana.md
Created February 10, 2012 04:05
Joe Armstrong on reusability in software (OO-vs-functional)

I think the lack of reusability comes in object-oriented languages, not functional languages. Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

If you have referentially transparent code, if you have pure functions-- all the data comes in its input arguments and everything goes out and leaves no state behind-- it's incredibly reusable. You can just reuse it here, there, and everywhere.

-Joe Armstrong, Designer and implementer of the Erlang programming language