This file contains hidden or 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
#!/usr/bin/env nix-shell | |
#! nix-shell -i python -p pythonPackages.treq pythonPackages.twisted pythonPackages.prometheus_client | |
import os | |
import time | |
from twisted.internet import reactor | |
from twisted.internet.task import LoopingCall, deferLater, react | |
from twisted.web.client import Agent | |
from twisted.web.server import Site |
This file contains hidden or 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
exports (main) | |
def mask(width :Int) :Int as DeepFrozen: | |
return (1 << width) - 1 | |
def shift(i :Int, offset :Int, width :Int) :Int as DeepFrozen: | |
return (i >> offset) & mask(width) | |
def makePointer(i :Int) as DeepFrozen: | |
return switch (i & 0x3): |
This file contains hidden or 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
import "unittest" =~ [=> unittest] | |
exports () | |
# Dead-simple regular expressions. | |
object empty as DeepFrozen: | |
to _printOn(out): | |
out.print("∅") |
This file contains hidden or 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
exports (main) | |
def mask(width :Int) :Int as DeepFrozen: | |
return (1 << width) - 1 | |
def shift(i :Int, offset :Int, width :Int) :Int as DeepFrozen: | |
return (i >> offset) & mask(width) | |
def makePointer(i :Int) as DeepFrozen: | |
return switch (i & 0x3): |
This file contains hidden or 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
#!/usr/bin/env nix-shell | |
#! nix-shell -i python -p pythonPackages.attrs pythonPackages.pyyaml | |
import attr | |
import yaml | |
@attr.s(frozen=True, slots=True) | |
class Subject(object): | |
name = attr.ib() |
This file contains hidden or 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
import subprocess | |
def pascalMod2(row): | |
rv = [1] | |
for i, x in enumerate(row, start=1): | |
if i == len(row): | |
break | |
rv.append((x + row[i]) % 2) | |
rv.append(1) | |
assert len(rv) == len(row) + 1 |
This file contains hidden or 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
#!/usr/bin/env nix-shell | |
#! nix-shell -i python -p python27Packages.attrs python27Packages.enum34 | |
# Let us have *timelines*, which are totally ordered sequences of observations | |
# of events tagged with (monotonic) timestamps. The possible states of | |
# observation are *aspects* of time from the event's point of view: | |
# {pu'o}: The event has not yet happened | |
# {ba'o}: The event has happened | |
# {ca'o}: The event is happening |
This file contains hidden or 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
from fractions import gcd | |
def makeRect(x, y): | |
return (x, y) if x < y else (y, x) | |
def fitsInside(larger, smaller): | |
return larger[0] <= smaller[0] and larger[1] <= smaller[1] | |
def smallerArea(rx, ry): | |
# Remember, bigger results here are still inverted. |
This file contains hidden or 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
#!/usr/bin/env nix-shell | |
# coding=utf-8 | |
#! nix-shell -i python -p pythonPackages.attrs pythonPackages.urwid pythonPackages.twisted pythonPackages.treq | |
from __future__ import division | |
import math | |
import time | |
import urllib |
This file contains hidden or 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
FROM nixos/nix:1.11 | |
# Set up Monte first. | |
RUN nix-channel --add https://hydra.matador.cloud/project/monte/channel/latest monte | |
RUN nix-channel --update | |
RUN nix-env -iA monte.monte | |
RUN nix-channel --list | |
RUN nix-env -iA nixpkgs.git |