Skip to content

Instantly share code, notes, and snippets.

@hjwp
hjwp / domain_model.py
Last active February 14, 2019 18:11
sqlalchemy mapping minimal example
'''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
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
<htmL>
<head>
<title>Hello, Greetings</title>
</head>
</html>
@hjwp
hjwp / python_django_resources.md
Created July 7, 2018 08:28
More Python and Django resources

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.

from selenium import webdriver

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 October 13, 2017 15:49
a tiny thing
print('i am file 1')
@hjwp
hjwp / .gitignore
Last active September 16, 2017 07:00
selenium alert dismiss repro attempt
geckodriver.log
@hjwp
hjwp / wagtail_hooks.py
Created August 9, 2017 05:39
a hideous hack to create a wagtail modeladmin view for a custom image class
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.forms.utils import flatatt
from django.shortcuts import redirect
from wagtail.wagtailimages.views.images import edit as image_edit_view
from wagtail.contrib.modeladmin import views
1489172367275 geckodriver INFO Listening on 127.0.0.1:60551
1489172368371 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.umgbzIjSgMQF
1489172368371 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1489172368373 geckodriver::marionette INFO Connecting to Marionette on localhost:36527
1489172369021 Marionette INFO Listening on port 36527
[Child 13641] WARNING: pipe error (3): Connection reset by peer: file /build/firefox-FILPL9/firefox-51.0.1+build2/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 323
[Child 13641] ###!!! ABORT: Aborting on channel error.: file /build/firefox-FILPL9/firefox-51.0.1+build2/ipc/glue/MessageChannel.cpp, line 2056
[Child 13641] ###!!! ABORT: Aborting on channel error.: file /build/firefox-FILPL9/firefox-51.0.1+build2/ipc/glue/MessageChannel.cpp, line 2056