Skip to content

Instantly share code, notes, and snippets.

Preliminary notes:
1. Where necessary the following function was used to convert parser output to
canonical form (to detect equivalent syntax trees up to associativity of
statement composition):
tx :: Stm -> Stm
tx (Comp (Comp a b) c) = tx (Comp a (Comp b c))
tx (Comp a b) = (Comp (tx a) (tx b))
tx (If b s1 s2) = (If b (tx s1) (tx s2))
module Proc where
import Prelude hiding (Num, and, lookup, map)
import Control.Applicative hiding (empty)
import Control.Arrow (second)
import Control.Monad
import Data.Functor.Identity (Identity)
import Data.Map.Lazy
import Data.Maybe
@jda0
jda0 / color.js
Last active April 28, 2018 15:10
class Color {
constructor (r, g, b) {
this.r = r
this.g = g
this.b = b
}
toHex () {
return [this.r, this.g, this.b].reduce(
(a, b) => a + ('00' + b.toString(16)).slice(-2),
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Maison Mono, Input Mono Light, Menlo, monospace",
"editor.fontSize": 13 /*13, 10, 11.4*/,
"editor.lineHeight": 15, /*12*/
"editor.rulers": [80],
"editor.wordWrap": "off",
"editor.wrappingIndent": "indent",
# DATA
## USER
email KEY string
name string
elevated boolean
auth string -> USER.email
key string
expires date
@jda0
jda0 / server.coffee
Last active April 19, 2018 19:24
flyt.server
###
REDIS SCHEMA
------------
SET @domain.al@email key
STRING @domain.ae@email token
HASH @domain.as@key A acl, S secret
HASH @domain.u@email N name, A acl, [T trustee], [X delete]
# required in process.env: host, cloudant_account, cloudant_key, cloudant_pass,
# cloudant_db_accounts, cloudant_db_data, cookie_secret, redis_url, redis_port, redis_path,
# smtp_email, smtp_pass, smtp_host, smtp_ssl
bodyParser = require 'body-parser'
cloudant = require 'cloudant' account: process.env.cloudant_account,
key: process.env.cloudant_key,
password: process.env.cloudant_pass
email = require 'email'
express = require 'express' ()
@jda0
jda0 / setup.sh
Last active February 28, 2018 06:27
#!/usr/bin/env bash
sudo apt update
sudo apt upgrade -y
sudo apt install curl wget git zip unzip -y
echo "Install all developer tools?"
select yn in "Yes" "No"; do
case $yn in
Yes ) sudo apt install -y build-essential cmake python-dev python3-dev golang-go nodejs
doctype html
html
head
link(rel='stylesheet', href='style.css')
title Flyt
body
header
nav.row
.left-unit
class Mastermind {
constructor() {
this.length = 4
this.chars = ['0', '1', '2', '3', '4', '5']
}
generate() {
this.guesses = 0
this.key = []
for (var i = 0; i < this.length; i++)