Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block pozorvlak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9c6fadd6b2afef2a83d51f4368474a8b
Updating a single variable in-place: closures get the new value because they fetch it from the lexical scope
$ cat
my @closures;
for (my $i = 0; $i < 3; $i++) {
push @closures, sub { print "$i\n"; };
for my $fn (@closures) {
# Script to (generate a script to) fix excess use of double-quotes in HAML.
# To use:
# haml-lint app/views/ > haml_errors
# grep "you don't need string interpolation" haml_errors | awk '{print $1}' > single_quote_me
# perl
# bash
# git commit -a -m "Use single-quotes in straightforward cases"
pozorvlak / gist:0d8077170b31090b8a5f
Created May 11, 2015
Find all ways of writing 100 as "1<op>2<op>3...9"
View gist:0d8077170b31090b8a5f
#!/usr/bin/env python
PLUS = '+'
MINUS = '-'
def op_sequences(n):
if n == 0:
yield []

"Write your name and badge number in the space provided. You may not turn over the exam paper until I say so."

Kung obediently picked up his pen, and wrote "Fury, K." in the first box and "4637" in the second.

He tried to breathe deeply and focus his qi, but the serenity he needed would not come. This was his last chance. He lived a bare, monastic existence and could live happily on a Detective's pay himself, but Bubbie Zosia's medical treatment got more expensive every month. She'd survived Hitler, and he was damned if he'd let her die from neglect. But he'd made some serious mistakes as a rookie which had blown his chances of promotion by the management track. That left only this track: heavily oversubscribed, and with a very low acceptance ratio. But at least the hours he'd spent in the dojo would now count in his favour.

A thought struck him. This was a test. Well, obviously this was a test. But maybe it was a test within a test?

Kung breathed deeply, stole a quick look at the proctor, and flicke

View PrimOp.lhs
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[PrimOp]{Primitive operations (machine-level)}
module PrimOp (
PrimOp(..), PrimOpVecCat(..), allThePrimOps,
primOpType, primOpSig,
primOpTag, maxPrimOpTag, primOpOcc,
pozorvlak / git-anonymize
Last active Dec 5, 2019
Anonymise Git history
View git-anonymize
# Suppose you want to do blind reviewing of code (eg for job interview
# purposes). Unfortunately, the candidates' names and email addresses are
# stored on every commit! You probably want to assess each candidate's version
# control practices, so just `rm -rf .git` throws away too much information.
# Here's what you can do instead.
# Rewrite all commits to hide the author's name and email
for branch in `ls .git/refs/heads`; do
pozorvlak /
Last active Jan 17, 2016
CRDT/Semilattice SITREP

Here's where I understand the state of the art to be:

  • In this INRIA tech report, Shapiro, Preguiça, Baquero and Zawirski (SPBZ) prove, amongst other things, that a sufficient condition for CRDTs to achieve eventual consistency on networks which may reorder and duplicate packets (which I'll call flaky networks, henceforth) is that
    1. the underlying datatype forms a semilattice,
    2. messages are full states,
    3. incoming messages are combined with the node's current state using the least-upper-bound operation in the semilattice.
  • It's possible to relax condition 2 and still achieve eventual consistency over flaky networks by fragmenting the state into independent parts and transmitting updates to each part separately. For instance, in the G-Set CRDT (an add-only bitset) one can transmit only the index of the element to be added.
  • In [these slides from a talk at Dagstuhl](
pozorvlak /
Last active Jun 8, 2018
CvRDTs are almost as general as they can be.

CvRDTs are (almost?) as general as they can be

What are you talking about, and why should I care?

Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to

pozorvlak /
Last active Dec 14, 2015
HiPEAC '13 Berlin conference report

What I saw on my holidays

by Miles, age 32¾

The giant fishtank in the Radisson Blue

General themes

Statue of a woman standing on her head

  • Big computations aren't just array-munging any more
pozorvlak / tc-arc.c
Created Jan 8, 2012
The Big Function Of Doom
View tc-arc.c
/* tc-arc.c -- Assembler for the ARC
Copyright 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
You can’t perform that action at this time.