Skip to content

Instantly share code, notes, and snippets.

View stephane's full-sized avatar
🎯
Focusing

Stéphane Raimbault stephane

🎯
Focusing
View GitHub Profile
@stephane
stephane / mappers.py
Created March 23, 2017 14:01
django-db-multitenant simple mapper example for PostgreSQL
"""Maps a request to a tenant using the first part of the hostname.
For example:
foo.example.com:8000 -> foo
bar.baz.example.com -> bar
This is a simple example; you should probably verify tenant names
are valid against a whitelist before returning them, since the returned
tenant name will be issued in a `SET search_path TO` SQL query.
@stephane
stephane / README.md
Last active April 9, 2020 21:19 — forked from larsenmtl/README.md
d3 mouseover multi-line chart

An interactive multi-line chart.

Note, I borrowed a bit of code from Duopixel's excellent code sample here.

Upgraded to D3v5.

@stephane
stephane / gist:da4901064c269e176c5b0a4d9acd770c
Created January 18, 2021 22:49
To run a big-endian system
# Doesn't work anymore
docker run -it —-rm —-privileged multiarch/qemu-user-static —-credential yes —-persistent yes
docker run -it —-rm s390x/ubuntu bash
# works
sudo pacman -S qemu qemu-extras
curl -O https://people.debian.org/~aurel32/qemu/powerpc/debian_wheezy_powerpc_standard.qcow2
qemu-system-ppc -hda debian_wheezy_powerpc_standard.qcow2
@stephane
stephane / .docker_ignore
Last active September 7, 2021 20:47
Docker file for Poetry
.git
__pycache__
app/static
{% macro field_label(field) -%}
<label class="form-label" for="{{ field.id }}">
{{ field.label.text }} {% if field.flags.required %}*{% endif %}
</label>
{%- endmacro %}
{% macro field(field, group_class=None, space_field_class="") -%}
<div class="form-group{% if group_class %} {{ group_class}}{% endif %}">
{{ field_label(field) }}
{% if field.errors %}