Skip to content

Instantly share code, notes, and snippets.

@dariusf
dariusf / Phantom.java
Created February 5, 2017 00:27
Phantom types in Java
class Files {
static void read(File<Open> file) {}
static File<Open> open(File<Closed> file) {
return null;
}
static File<Closed> close(File<Open> file) {
return null;
}
}
[ 'agatha began to like ben because of no known reason',
'charles began to hate agatha because agatha began to like ben',
'ben began to like charles because charles began to hate agatha',
'agatha began to like ben because agatha began to like ben',
'charles began to hate agatha because charles began to hate agatha',
'charles killed agatha out of spite because charles began to hate agatha'
]

Install Forge

  • Install vanilla minecraft server
  • Download Forge installer https://files.minecraftforge.net/
    • Install client (point at Minecraft data directory)
    • Install server (point where you installed the vanilla server)
    • Extract and copy that file to the server directory

Install Botania

// World state, changes over time
// Can be a task queue, or just some state like this
var enemiesNearby = true;
setInterval(() => enemiesNearby = !enemiesNearby, 1500);
// Simulates some async task
negation_(not(Statement), Statement).
negation_(Statement, not(Statement)).
negation(S, N) :- once(negation_(S, N)).
negated(X) :- functor(X, not, _).
set_union(X, Y, Z) :- append(X, Y, Z0), sort(Z0, Z).
negate_all(X, Y) :- maplist(negation, X, Y).
one_culprit(Facts) :-
from urwid import *
def unhandled_input(key):
# print 'got some event', key
if key == 'esc' or key == 'q':
raise ExitMainLoop()
single_color = [
('basic', 'yellow', 'dark blue'),
Initial = [
accessible(mon_house, town),
accessible(town, mon_house),
accessible(cap_house, town),
accessible(town, cap_house),
at(romeo, town),
at(montague, mon_house),
at(capulet, cap_house),
at(mercutio, town),
// Purely functional: no mutable state
// Imperative programming: no need for monads to sequence computations
// Stringly-typed: type system is both weak and string at the same time
// Object-oriented programming: or anything you can string together
// Elegant error-handling: garbage in, garbage out
// Literate programming: use emoji to clarify obscure code
// 'programs'

stop words: the, that, and, was, her, she, had, not, this, for, with, were, there, from, then, would, his, have, been, also, which, did, when, whether, but, who, him, could, they, these, where, into, went, than, what, very, our, has, are, their, how, why, here

word frequency
accused 651
deceased 444
slr 161
prosecution 156
➜ ~/python python3 poetry.py
damoose cathay than saves 'n francophile
for steinberg krass cutugno sowed because
lheureux hm phillip's projects' mercantile
forestalls mochida staffers doty kaus
bertino whittinghill employ pingree
adele affliction whetsel welles' amar's
debater argentina honoree
kuwait ferraris neeld will detjen kahrs
with choppy inacom attenuates