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
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 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
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.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
# -*- coding: utf-8 -*- | |
import scrapy | |
from scrapy.linkextractors import LinkExtractor | |
class SiegeSpider(scrapy.Spider): | |
name = "siege" | |
def __init__(self, domain, *args, **kwargs): | |
super(SiegeSpider, self).__init__(*args, **kwargs) | |
urlBase = 'https://%s/' % domain |
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 bash -p python27Packages.scrapy jq | |
echo "https://$1/" > urls.txt | |
scrapy runspider siege.py -a domain=$1 -t json -o - | jq -r '.[] | .url' >> urls.txt |
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.twisted pythonPackages.prometheus_client | |
from twisted.internet.task import deferLater, react | |
from twisted.web.server import Site | |
from twisted.web.resource import Resource | |
from prometheus_client.twisted import MetricsResource | |
def main(reactor): |