This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main | |
%default total | |
data Rational = MkRational Nat Nat | |
numerator : Rational -> Nat | |
numerator (MkRational n d) = n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The contents of this file go in ~/.ssh/config | |
ControlMaster auto | |
ControlPath ~/.ssh/sockets/%h_%p_%r | |
ControlPersist yes | |
TCPKeepAlive yes | |
# try to keep connections open for four hours (adjust as you see fit) | |
ServerAliveInterval 4 | |
ServerAliveCountMax 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A minimal security monad that allows low-security and high-security elements | |
* to be mixed, but in all places where the values are mixed, the output | |
* adopts the highest-security tag. This is useful in situations where | |
* sensitive data pervades many computational contexts and where the security | |
* rules are bipolar (strictly public/private, etc.) | |
* | |
* @author Garrett Bluma | |
* @date Apr 9, 2012 (Monad design and implementation) | |
* @revised Oct 2, 2014 (Cleaned up. Added examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DictionaryParser { | |
requires package "re2"; | |
open Regdef; | |
struct KeyValue { | |
key : string; | |
value : string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float n() { | |
return random(50); | |
} | |
float[] soften(float[] curve) { | |
for (int i=0; i<19;i++){ | |
curve[i] = curve[i] + (curve[i]-curve[i+1])/5; | |
} | |
for (int i=19; i>0; i--){ | |
curve[i] = curve[i] + (curve[i-1]-curve[i])/5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require 2htdp/batch-io) ; provides read-csv-file | |
(require srfi/1) ; provides reduce function | |
(require plot) ; provides plot function | |
;; helper functions | |
(define (sum xs) (reduce + 0 xs)) | |
(define (square x) (* x x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: support more than just linux/osx | |
include "std/posix/filesystem"; | |
// TODO: add this to std/io/textio.flx, it's missing | |
gen fopen_append : string -> ofile = '::std::fopen($1.c_str(), "a")'; | |
object Repl () = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use something easier to type as the prefix. | |
set -g prefix C-f | |
unbind C-b | |
bind C-f send-prefix | |
# Relax! | |
set -sg escape-time 0 | |
set -sg repeat-time 600 | |
# This is hilariously absurd. How many nerds use tmux on OS X every day and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Title: An example of Object Algebras in Felix | |
// Author: Garrett Bluma | |
// Date: June 29, 2015 | |
// Special thanks to Bruno Oliveira and William Cook for explaining object | |
// algebras, and for providing examples. | |
// <http://i.cs.hku.hk/~bruno/oa/> | |
// ----------------------------------------- | |
// Object algebras use extension via type parameters and inheritance. Given a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CT | |
{ | |
class Semigroup[T,U] { | |
virtual fun \circ : T * T -> T; | |
} | |
class Monoid[T,U] { | |
inherit Semigroup[T,U]; | |
virtual fun id : () -> T; |
OlderNewer