Skip to content

Instantly share code, notes, and snippets.

View bbc2's full-sized avatar

Bertrand Bonnefoy-Claudet bbc2

View GitHub Profile
@bbc2
bbc2 / Keybase
Last active April 22, 2019 21:39
### Keybase proof
I hereby claim:
* I am bbc2 on github.
* I am bertrandbc (https://keybase.io/bertrandbc) on keybase.
* I have a public key whose fingerprint is 9632 F322 CF0D 0BB6 9262 DA31 82ED DC1E 8CAB 3D73
To claim this, I am signing this object:
@bbc2
bbc2 / code_in_a_list.org
Last active August 29, 2015 14:18
GitHub org-mode markup list code bug

The code block has an extra line at the end:

  • See:
    # some code
    print('hello world!')
        
@bbc2
bbc2 / begin.v
Created December 10, 2014 15:17
Proofs on addition and multiplication in Coq
Fixpoint add (x:nat) (y:nat) : nat :=
match x with
| 0 => y
| S z => S (add z y)
end.
Lemma add_0 : forall x, add x 0 = x.
intros x.
induction x.
- reflexivity.
@bbc2
bbc2 / json_parser.py
Created December 10, 2014 12:27
Naive JSON parser
#!/usr/bin/env python
import re
import sys
HEX_DIGITS = '0123456789abcdefABCDEF'
NUMBER_RE = re.compile(r'-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?')
class ParseError(Exception):
pass
@bbc2
bbc2 / client.py
Created November 30, 2014 13:46
CoAP server bug
import asyncio
import aiocoap
@asyncio.coroutine
def observe(protocol, addr):
host, port = addr
request = aiocoap.Message(code=aiocoap.GET)
request.set_request_uri('coap://{}:{}/time'.format(host, port))
request.opt.observe = 0
requester = protocol.request(request)