Skip to content

Instantly share code, notes, and snippets.

@hjwp
hjwp / default-acl.json
Last active May 4, 2020
Eventstore perms bug repro
View default-acl.json
[{
"eventId": "7c314750-05e1-439f-b2eb-f5b0e019be72",
"eventType": "update-default-acl",
"data": {
"$userStreamAcl" : {
"$r" : ["$admin", "$ops", "test-user"],
"$w" : ["$admin", "$ops", "test-user"],
"$d" : ["$admin", "$ops"],
"$mr" : ["$admin", "$ops"],
"$mw" : ["$admin", "$ops"]
View mymodule.py
def foo() -> int:
return 42
@hjwp
hjwp / bowling.py
Last active Nov 23, 2019
Bowling TDD Kata
View bowling.py
STRIKE = 'X-'
def score_frame(frame, next_frame):
if frame[:2] == STRIKE:
if next_frame == STRIKE:
return 20
if next_frame is LAST_FRAME:
first_ball_next_frame = int(frame[2])
second_ball_next_frame = int(frame[3])
else:
@hjwp
hjwp / domain_model.py
Last active Feb 14, 2019
sqlalchemy mapping minimal example
View domain_model.py
'''stripped-down domain model, just order and warehouse'''
from __future__ import annotations
from dataclasses import dataclass
@dataclass(unsafe_hash=True)
class Line:
sku: str
qty: int
View Dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -y -q python3.7 python3.7-dev python3-pip git
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
RUN pip3 install pip pipenv
WORKDIR /tmp
View index.html
<htmL>
<head>
<title>Hello, Greetings</title>
</head>
</html>
@hjwp
hjwp / python_django_resources.md
Created Jul 7, 2018
More Python and Django resources
View python_django_resources.md

Introductions to Python

In case some people don't get on well with the pluralsight course, there's a wealth of free Python resources out there. See the list on the /r/learnpython wiki:

I personally learned from "Dive into Python" which I recommend, it's nice and fast paced, aimed at people who already know programming in another language, and is linked there.

View keybase.md

Keybase proof

I hereby claim:

  • I am hjwp on github.
  • I am hjwp (https://keybase.io/hjwp) on keybase.
  • I have a public key ASCDSKFHU12BdBf8anQUt_MjeXUbDrPT8W1GjWbhRpa-QQo

To claim this, I am signing this object:

@hjwp
hjwp / file1.py
Created Oct 13, 2017
a tiny thing
View file1.py
print('i am file 1')
You can’t perform that action at this time.