Skip to content

Instantly share code, notes, and snippets.

View rockymadden's full-sized avatar
:octocat:
Setting status

Rocky Madden rockymadden

:octocat:
Setting status
  • UiPath
  • Pale Blue Dot
View GitHub Profile
module Main where
-- A simple directory summing thing for Haskell.
-- by Daniel Lyons <fusion@storytotell.org>
-- BSD licensed.
import Control.Applicative
import Data.Either
import Data.Foldable
@rockymadden
rockymadden / .bashrc
Last active August 29, 2015 14:04
Easy OSX GHC version switching and management via ghc-dot-app: https://github.com/ghcformacosx/ghc-dot-app
export CABALPATH=$HOME/.cabal
export PATH=$PATH:$CABALPATH/bin
function switchghc() {
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/cabal" /usr/local/bin/cabal
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/ghc-$@" /usr/local/bin/ghc
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/ghc-pkg-$@" /usr/local/bin/ghc-pkg
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/ghci-$@" /usr/local/bin/ghci
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/haddock-ghc-$@" /usr/local/bin/haddock
ln -sf "/usr/local/lib/ghc-$@.app/Contents/bin/hp2ps" /usr/local/bin/hp2ps
{-# LANGUAGE PackageImports #-}
{-
You need to register your Twitter application at <http://dev.twitter.com/>
to get the consumer key and secret needed for OAuth. When connecting to
Twitter for the first time, do this:
let consumer = Consumer "consumer key" "consumer secret"
token <- authenticate

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@rockymadden
rockymadden / csp-pong.js
Last active August 29, 2015 14:16
CSP based pong in ES6 JavaScript.
"use strict";
const csp = require("js-csp");
const setup = (table) => {
const player = function*(name) {
let ball;
while((ball = yield csp.take(table)) !== csp.CLOSED) {
ball.hits += 1;
@rockymadden
rockymadden / hubdecrypt.sh
Created October 9, 2015 02:31 — forked from rgbkrk/hubdecrypt.sh
Encrypt a (short) file using someone's public key from github
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
@rockymadden
rockymadden / multi_key_crypto.sh
Created October 9, 2015 02:31 — forked from kennwhite/multi_key_crypto.sh
OpenSSL command line recipe for multi-public key file encryption. Any single private key paired to one of the public keys can decrypt the file.
#!/usr/bin/env bash
#
# Example of multiple key AES encryption for text files using the openssl v. 0.9.8+ command line utility
# Uses n public certs as key for MIME PKCS envelope, any individual private key can decrypt.
#
# If standard RSA ssh keys exist, these can be converted to public certs as well (and ssh keys can decrypt)
#
# To sign (and verify) the encrypted file, one of the private keys is required, see:
# http://www.openssl.org/docs/apps/smime.html#EXAMPLES for openssl smime examples
# or http://www.openssl.org/docs/apps/cms.html#EXAMPLES for cms utility (OpenSSL v. 1.0+)
package com.rockymadden.collection.mutable
import scala.annotation.tailrec
import scala.collection.generic.CanBuildFrom
import scala.collection.mutable.{Builder, Map, MapBuilder, MapLike}
final class PrefixMap[A] extends Map[String, A] with MapLike[String, A, PrefixMap[A]] {
private val suffixes: Map[Char, PrefixMap[A]] = Map.empty
private var value: Option[A] = None
@rockymadden
rockymadden / processing-chassis-3u-8node.md
Last active December 17, 2015 05:58
One simple example of a 10u/13node hardware private cloud infrastructure. Built specifically for colocation, based on how datacenters often slice up their racks (e.g. 10u/quarter rack is very common). Saves a few hundred thousand dollars over AWS in three years time. Replace/repeat at that time and then put these into a Hadoop cluster or somethi…

This chassis houses up to 8 processing nodes. Each node is roughly equivilent to 30 elastic compute units. You can scale as needed by building and slotting more nodes into the chassis. Candidates for these nodes includes: app servers of any kind, ssl termination/reverse proxies, cache servers, distributed/concurrent processing, cron jobs, etc.

Barebone:


Per node (up to 8):