This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django Management Command to print a "Magic Link" for one-click login | |
by Jeff Triplett <jefftriplett> / https://twitter.com/webology | |
https://gist.github.com/jefftriplett/e87b36d750f94e48080a2be46e71dbe1 | |
Relies on: https://github.com/aaugustin/django-sesame | |
$ pip install django-click | |
$ pip install django-sesame[ua] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: static | |
static: | |
@npx -p tailwindcss@1.7.5 tailwindcss build ./assets/index.css \ | |
--config ./assets/tailwind.config.js \ | |
--output ./frontend/css/output.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
web: | |
container_name: my-fancy-container | |
image: docker.pkg.github.com/jefftriplett/private-repo/private-project:latest | |
labels: | |
- "com.centurylinklabs.watchtower.enable=true" | |
- "com.centurylinklabs.watchtower.lifecycle.post-update='./post-update.sh'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import frontmatter | |
import requests | |
import typer | |
def main(url: str): | |
request = requests.get(url) | |
post = frontmatter.loads("") | |
headers = request.headers | |
post["headers"] = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
$ wget https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.json | |
$ python django-top-100.py | |
""" | |
import json | |
from pathlib import Path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mypy] | |
python_version = 3.7 | |
ignore_missing_imports = True | |
plugins = | |
mypy_django_plugin.main, | |
mypy_drf_plugin.main | |
strict_optional = True | |
[mypy.plugins.django-stubs] | |
django_settings_module = "config.test_settings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update project requirements when requirements.txt changes. | |
requirements.txt { | |
prep +onchange: "pip install -U -r requirements.txt" | |
} | |
../.envrc { | |
prep +onchange: "direnv allow" | |
} | |
**/index.css **/tailwind.config.js { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.7 | |
COPY hello.py / | |
CMD [ "python", "/hello.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the test suite if a source or test file changes | |
**/tests/test_*.py { | |
# prep +onchange: pytest @dirmods | |
prep +onchange: pytest @mods | |
} | |
requirements.txt { | |
# prep +onchange: pytest @dirmods | |
prep +onchange: " | |
pip install -U -r requirements.txt |