Skip to content

Instantly share code, notes, and snippets.

@namchuai
Forked from benwalio/uuid.jinja
Created January 4, 2023 16:15
Show Gist options
  • Save namchuai/bfd58d7145170a38af04fa9af7dbd7a6 to your computer and use it in GitHub Desktop.
Save namchuai/bfd58d7145170a38af04fa9af7dbd7a6 to your computer and use it in GitHub Desktop.
create a basic uuid using jinja2
{%- set ns = namespace(uuid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') %}
{%- set ns.new_uuid = '' %}
{%- for x in ns.uuid %}
{%- set ns.new_uuid = [ns.new_uuid,(x | replace('x', [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f'] | random ))] | join %}
{%- endfor %}
{{ ns.new_uuid }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment