Skip to content

Instantly share code, notes, and snippets.

View anthonyclays's full-sized avatar

Anthony Clays anthonyclays

  • Leuven, Belgium
View GitHub Profile
@anthonyclays
anthonyclays / meta_fizzbuzz.py
Created March 28, 2016 15:34
meta-FizzBuzz
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import combinations
from operator import mul
def all_combinations(things):
for i in xrange(len(things), 0, -1):
for result in combinations(things, i):
yield result
@anthonyclays
anthonyclays / reveng_of_the_pancakes.pl
Last active April 10, 2016 08:38
Revenge of the pancakes
<>; # ignore first line of input
foreach(<>) {
chomp; # get rid of the newline
$t++; # increment case number (implicitly initialized to zero)
s/([+-])\1+/\1/g; # simplify stack of pancakes: consecutive similarly-facing pancakes are squashed together
s/\+$//; # if the last pancake is already facing the correct way: ignore it
$l=length; # get the height of the stack
print"Case #$t: $l\n" # print it
}
@anthonyclays
anthonyclays / keybase.md
Created April 12, 2017 21:11
keybase.md

Keybase proof

I hereby claim:

  • I am anthonyclays on github.
  • I am anthonyclays (https://keybase.io/anthonyclays) on keybase.
  • I have a public key ASCkuz87qTzF5PVYgrNV8vypyCjhDFDm2MJwOWe6OpdBIQo

To claim this, I am signing this object:

@anthonyclays
anthonyclays / minesweeper.py
Created April 18, 2017 11:23
Guesswork-free 3D minesweeper
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from itertools import product, chain, count
import random, time
from z3 import *
N, M = 6, 11
@anthonyclays
anthonyclays / server.py
Created April 12, 2019 15:03
Simple server that runs a process for each client connection
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import asyncio
import click
async def copy(src, dst):
buf = await src.read(1024)
while buf:
dst.write(buf)