Skip to content

Instantly share code, notes, and snippets.

View mbbx6spp's full-sized avatar
:shipit:
emacsclient -nw README.md

Susan Potter mbbx6spp

:shipit:
emacsclient -nw README.md
View GitHub Profile
@mbbx6spp
mbbx6spp / .gitignore
Last active April 20, 2017 03:45
Node JS streams reproduction of problem in simplest form
node_modules
@mbbx6spp
mbbx6spp / church-numerals.scala
Last active April 13, 2017 15:09 — forked from tommysullivan/church-numerals.scala
A fork for a friend's Gist to demonstrate some things
/*
SP: currying this gives the type: (T => T) => T => T
That looks an awful lot like Haskell's application ($) operator. :)
There is a higher order abstraction here, sniff it out.
*/
type ChurchNumeral[T] = (T => T, T) => T
def cn0[T](f:T=>T, x:T):T = x
def cn1[T](f:T=>T, x:T):T = f(x)
def cn2[T](f:T=>T, x:T):T = f(f(x))
@mbbx6spp
mbbx6spp / LAZY.md
Last active March 29, 2017 21:58
Silly benchmark to satisfy my burning curiousity.
$ ruby bench/lazy.rb
                                                                                                           user     system      total        real
using Range#lazy                                                                                       0.330000   0.000000   0.330000 (  0.330689)
using Enumerator#yield                                                                                 0.170000   0.000000   0.170000 (  0.177117)
using Fiber#yield                                                                                      0.340000   0.120000   0.460000 (  0.458015)
@mbbx6spp
mbbx6spp / mutualrecursion.hs
Last active January 5, 2017 04:00
Initial motivating example for using recursion schemes
-- module of natural number properties ... and stuff
module Naturally where
import Prelude hiding (even, odd)
-- recursive data structure
data Nat = Zero -- base case is "zero"
| Succ Nat -- successor of another Nat is the "recursive" case data constructor
deriving (Eq)
@mbbx6spp
mbbx6spp / RUBY_v2.4.0.md
Last active December 25, 2016 18:25
Some of the Ruby v2.4.0 changes

Unified Fixnum and Bignum into Integer

It's backward compatible too.

$ irb
irb(main):001:0> RUBY_VERSION
=> "2.3.1"
irb(main):002:0> (2**100).class
=> Bignum
@mbbx6spp
mbbx6spp / myservice.nix
Last active December 7, 2016 17:59
Interface to defining services that can build dev VM, AMI, container, etc. images or deploy production-oriented ASGs, or other programmable infrastructure constructs. An artifact would have a specific structure based on a contract such that service runtime could be configured and built from it.
# Abstract
{ mkService, serviceArtifact, privateIfc, lbSource, authService, dataService, logService, logPath, secretsPath }:
mkService {
name = "service-name";
version = "0.1.2";
artifacts = [ serviceArtifact ];
listens = [ { type = "tcp"; port = 9999; interface = privateIfc; } ];
accepts = [ lbSource ]; # traffic sources to accept traffic from.
talks = [ authService dataService logService ]; # this allows auto configuration given the service definitions of those in the specific environment.
writes = [ logPath ];
@mbbx6spp
mbbx6spp / RULE41.md
Last active January 4, 2017 09:06
Call your senators and US representative now, before November 30, 2016 end of day.
@mbbx6spp
mbbx6spp / .Xdefaults
Last active November 25, 2016 23:48
Minimal keyboard shortcut bindings for increasing and decreasing font size in URxvt
!! Things to include in your ~/.Xdefaults
! Ensure font-size is included in your URxvt.perl-ext comma separated list of extensions, like below
URxvt.perl-ext: default,matcher,fullscreen,font-size,url-select,selection-to-clipboard
! specify the step font-size for incrementing and decrementing
URxvt.font-size.step: 1
! Bind Ctrl+Up and Ctrl+Down to font increment and decrement respectively
URxvt.keysym.C-Up: perl:font-size:incglobal
URxvt.keysym.C-Down: perl:font-size:decglobal
@mbbx6spp
mbbx6spp / README.md
Created November 2, 2016 14:55
Demonstrate difference between load and require in Ruby
[nix-shell:~/src]$ cat x.rb y.rb crap.rb
# x.rb
load 'crap.rb'
load 'crap.rb'
# y.rb
require 'crap.rb'
require 'crap.rb'
# crap.rb
puts 'hi'
@mbbx6spp
mbbx6spp / .gpgopts
Last active October 31, 2016 22:33
Script to use in a Jenkins job to reset IAM logins for a "self-serve" interface through internal systems. You must fill in the .gpgopts file with --recipient KEYID options and put it in the working directory of the script when invoking it from Jenkins. You also need to ensure the keys are in the Jenkins user gpg key store and that it will not pr…
--recipient GPG64BITKEYID