Skip to content

Instantly share code, notes, and snippets.


Paul Schoenfelder bitwalker

View GitHub Profile
View .conf = person = 25 = dog = biz
View .conf = person = 25 = dog = 5

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

bitwalker / Maths.cs
Last active Aug 29, 2015
.NET Newsletter #1 - Challenge
View Maths.cs
using System;
using System.Numerics;
public class Program
public void Main(params string[] args)
foreach (var n in Maths.Fib().Take(100))
View Clock.scala
import js.{JSApp, Date}
import Page.{canvas, renderer}
import dom.window
* An example of Scala/Scala.js code which renders a clock using HTML5 Canvas
* @author Paul Schoenfelder
object ScalaJSExample extends JSApp {
bitwalker / bowling.ex
Last active Oct 14, 2015
Bowling scorer in Elixir
View bowling.ex
defmodule Bowling do
@moduledoc """
Takes a bowling game score, with 10 frames seperated by spaces:
`X 53 18 5/ 5/ 44 36 35 9/ 9/4`
An ‘X’ marks a strike, a ‘/’ marks a spare. All frames can have 2 bowls,
except for the last which has up to 3. Your challenge is to come up with a
program that takes the above string as an input and outputs the integral score.
bitwalker / parallel_executor.ex
Created Nov 23, 2015
Parallel Executor for Elixir
View parallel_executor.ex
defmodule ParallelExecutor do
@moduledoc """
This module in conjunction with it's implementation of the Collectable
protocol, handles executing tasks over an enumerable/stream in parallel,
up to a provided parallelization factor `F`. It implements a backpressure mechanism
to ensure that there are never more than, but at least `F` tasks executing.
alias __MODULE__
defstruct procs: 4, func: nil, tasks: []

The Indexed State Monad in Haskell, Scala, and C#

Have you ever had to write code that made a complex series of succesive modifications to a single piece of mutable state? (Almost certainly yes.)

Did you ever wish you could make the compiler tell you if a particular operation on the state was illegal at a given point in the modifications? (If you're a fan of static typing, probably yes.)

If that's the case, the indexed state monad can help!


bitwalker / output.txt
Created Dec 15, 2015
Elixir 1.2.0-rc.0 error
View output.txt
{error_logger,{{2015,12,15},{15,50,17}},"~s~n",["driver_select(0x0000000020000ce8, 0, ERL_DRV_READ ERL_DRV_USE, 1) by tty_sl (tty_sl -c -e) driver #Port<0.630> failed: fd=0 (re)selected before stop_select was called for driver tty_sl\n"]}
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
=ERROR REPORT==== 15-Dec-2015::09:50:17 ===
driver_select(0x0000000020000ce8, 0, ERL_DRV_READ ERL_DRV_USE, 1) by tty_sl (tty_sl -c -e) driver #Port<0.630> failed: fd=0 (re)selected before stop_select was called for driver tty_sl
Interactive Elixir (1.2.0-rc.0) - press Ctrl+C to exit (type h() ENTER for help)
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded