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
from veri import Verified | |
class Something(metaclass=Verified): | |
# a single type | |
some_int = int | |
some_str = str | |
# a 'struct' using tuples | |
some_tuple = (int, int, str) | |
# a list of integers |
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
import sys | |
vowels = set('aeiouy') | |
consonants = set('bcdfghjklmnpqrstvwxz') | |
impossible_digraphs = ['aa', 'bg', 'bh', 'bk', 'bq', 'bw', 'bx', 'bz', 'cb', 'cf', 'cg', 'cj', 'cm', 'cp', 'cv', 'cw', 'cx', 'cz', 'dx', 'dz', 'fc', 'fd', 'fg', 'fj', 'fk', 'fn', 'fp', 'fq', 'fv', 'fw', 'fx', 'fz', 'gc', 'gj', 'gk', 'gq', 'gv', 'gx', 'gz', 'hj', 'hk', 'hq', 'hv', 'hx', 'hz', 'ij', 'iy', 'jb', 'jc', 'jd', 'jf', 'jg', 'jh', 'jj', 'jk', 'jl', 'jm', 'jn', 'jp', 'jq', 'jr', 'js', 'jt', 'jv', 'jw', 'jx', 'jy', 'jz', 'kq', 'kv', 'kx', 'kz', 'lj', 'lx', 'md', 'mj', 'mk', 'mq', 'mx', 'mz', 'pg', 'pj', 'pq', 'pv', 'px', 'pz', 'qa', 'qb', 'qc', 'qd', 'qe', 'qf', 'qg', 'qh', 'qi', 'qj', 'qk', 'ql', 'qm', 'qn', 'qo', 'qp', 'qq', 'qr', 'qs', 'qt', 'qv', 'qw', 'qx', 'qy', 'qz', 'rx', 'sx', 'sz', 'tq', 'tx', 'uj', 'uq', 'uw', 'uy', 'vb', 'vc', 'vd', 'vf', 'vg', 'vh', 'vj', 'vk', 'vl', 'vm', 'vn', 'vp', 'vq', 'vr', 'vs', 'vt', 'vv', 'vw', 'vx', 'vz', 'wj', 'wk', 'wp', 'wq', 'wv', 'ww', 'wx', 'wz', 'xb', 'xf', 'xg', 'xj', 'xk', 'xm', |
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
%{ | |
#include "units.tab.c" | |
%} | |
%option noyywrap | |
int -?[0-9]+ | |
%% | |
[ \t] /*empty*/ |
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
import gc | |
import weakref | |
class Object(object): pass | |
l = [Object()] | |
l[0].l = l | |
REFS = weakref.WeakKeyDictionary() | |
REFS[l[0]] = True |
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
#include <signal.h> | |
void stop_self() | |
{ | |
raise(SIGSTOP); | |
} | |
int main() | |
{ | |
struct sigaction act; |
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
#!/usr/bin/env python | |
import argparse | |
import sys | |
def tokenize(source): | |
return list(source) | |
def parse(tokens): |
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
-- kilobyte (and megabyte) constants | |
-- string like methods | |
-- implicit multiplication | |
-- successor function | |
debug.setmetatable(0, { __index = function(n, k) | |
if k == 'K' then | |
return n * 1024 | |
elseif k == 'M' then | |
return n * 1024 * 1024 | |
else |
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
""" | |
formula.py - propositional formulas for Python | |
by Robin Wellner | |
Hereby, I waive all rights to this library, as described at <http://creativecommons.org/publicdomain/zero/1.0/> | |
Examples: | |
foo = Atom('foo') | |
bar = Atom('bar') |
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
-- CC0, see http://creativecommons.org/publicdomain/zero/1.0/ etcetera, etcetera | |
function from(source, which) | |
local t = require(source) | |
local function import (which) | |
if which == '*' then | |
for k, v in pairs(t) do | |
if _G[k] == nil then | |
_G[k] = v | |
end |
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 Alias(object): | |
def __init__(self, initial): | |
self._set = {initial} | |
self.initial = initial | |
def add(self, alias): | |
self._set.add(alias) | |
def merge(self, other): | |
self._set.update(other._set) | |
def __iter__(self): | |
return iter(self._set) |