Skip to content

Instantly share code, notes, and snippets.

View pierremonico's full-sized avatar

Pierre Monico pierremonico

View GitHub Profile
@pierremonico
pierremonico / uuid_from_strings.py
Created November 23, 2021 10:59
Helper function to generate a deterministic UUID from a list of strings
import uuid
import hashlib
def uuid_from_strings(*args: str) -> str:
"""Generates a deterministic UUID when given n strings."""
seed = "".join(args)
m = hashlib.md5()
m.update(seed.encode("utf-8"))
return str(uuid.UUID(m.hexdigest()))
@pierremonico
pierremonico / Localize Vue files with Django `makemessages`.md
Last active April 26, 2022 13:51
Localize Vue files with Django `makemessages`

NB: the whole approach of serving a Vue project through Django is less than ideal, so this can be seen as deprecated.

Intro

The goal of this gist is to be able to use the built-in makemessages command of Django on your Vue frontend. You can then expose a JavaScript catalog and localize your frontend using gettext.

Following assumptions are made:

  • The directory for the frontend lives in your Django project
  • You are using components (.vue files)

Include the JS Catalog view

Somewhere in urls.py:

@pierremonico
pierremonico / Postman.desktop
Last active April 27, 2023 11:52 — forked from aviskase/Postman.desktop
Install Postman
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;