Skip to content

Instantly share code, notes, and snippets.

View dckc's full-sized avatar

Dan Connolly dckc

View GitHub Profile
@dckc
dckc / fmontec.mt
Last active August 29, 2015 14:26
Pumps should always see stopped()
# fast monte compiler (after fsc fast scala compiler)
traceln("fmontec...")
def [=> makeHTTPEndpoint] | _ := import("lib/http/server")
def [=> strToInt] | _ := import("lib/atoi")
def [=> kludgeListDir, => makeFileRead] | _ := import("fun/lafile")
def [=> start] | _ := import("fun/fmontec0")
@dckc
dckc / kludge-log.txt
Last active August 29, 2015 14:27
utf8.ty as javascript, sort of
go...
jstarget.js:223 KLUDGE: guard??? Object
jstarget.js:223 KLUDGE: final (let) Object
jstarget.js:223 KLUDGE: final (let) Object
jstarget.js:223 KLUDGE: guard??? Object
jstarget.js:223 KLUDGE: final (let) Object
jstarget.js:223 KLUDGE: slot (guard) Object
jstarget.js:223 KLUDGE: slot (guard) Object
jstarget.js:223 KLUDGE: ignored param? Object
jstarget.js:223 KLUDGE: ignored param? Object
@dckc
dckc / lafile.mt
Created August 19, 2015 04:19
check monte doc examples a la doctest/updoc
# move all this somewhere?
def [=> UTF8] | _ := import("lib/codec/utf8")
def decodeContents(r):
def bs := r.getContents()
def cs := when(bs) -> { escape badText { UTF8.decode(bs, badText) } catch _ { "" } }
return cs
def kludgeListDir(makeProcess, makeFileResource):
@dckc
dckc / evil.pony
Created August 29, 2015 18:19
pony modules can launch missiles by default
use "net/http"
actor Planter
let _out: StdStream
let _addr: String = "http://missiles/launcher"
new create(out: StdStream) =>
_out = out
be plant(flower: String) =>
@dckc
dckc / log.txt
Last active September 22, 2015 06:34
monte import example: working!
monte/docs/source/tut$ montedo top.mt
Importing: /nix/store/k19a26lyj08lrgpzlbzckzc6bzwmvy0r-typhon/mast/prelude.ty
Importing: /nix/store/k19a26lyj08lrgpzlbzckzc6bzwmvy0r-typhon/mast/prelude/deepfrozen.ty
...
Importing: top.ty
Taking initial turn in script...
Instantiating module...
Importing: /nix/store/k19a26lyj08lrgpzlbzckzc6bzwmvy0r-typhon/mast/m1.ty
Importing: ./m1.ty
Running module...
@dckc
dckc / README.md
Last active September 23, 2015 02:35
cap_enter() in pony works on capsicum linux in one case Sat Aug 29 23:27:24 CDT 2015
@dckc
dckc / README.md
Last active September 23, 2015 03:24
SES on node works in one case Mon Sep 21 23:31:08 CDT 2015
@dckc
dckc / sgp.py
Created November 3, 2011 02:23
Supergenpass algorithm in python
__author__ = 'Dan Connolly'
__contact__ = 'http://www.madmode.com/'
__license__ = 'dedicated to the public domain, aka CC0'
from base64 import b64encode
from hashlib import md5
import re
def gp2_generate_passwd(Passwd, Len):
'''
@dckc
dckc / sareport.py
Created November 8, 2011 22:13
SQLAlchemy test case that worked in 0.7.2 and doesn't in 0.7.3
from sqlalchemy import Table, Column, text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import INTEGER, VARCHAR, TEXT
from sqlalchemy.sql import select, and_, func
Base = declarative_base()
institutions = ('kuh', 'kupi', 'kumc')
redcap_data = Table('redcap_data', Base.metadata,
@dckc
dckc / money.scala
Created November 11, 2011 07:32
ocap money in scala
/** transcription of money example from "Smart Contracts"
http://www.erights.org/smart-contracts/index.html
http://www.erights.org/elib/capability/ode/ode-capabilities.html
*/
abstract class Purse { // should this go inside Mint somehow?
def getBalance(): Int // hmm... num type? typeclass trick?
def sprout(): Purse
def getDecr(): Object
def deposit(amount: Int, src: Purse)