Skip to content

Instantly share code, notes, and snippets.

@benwalio
Created August 11, 2021 16:45
Show Gist options
  • Save benwalio/8598cf9f642271ffdaf3daa82c1802cb to your computer and use it in GitHub Desktop.
Save benwalio/8598cf9f642271ffdaf3daa82c1802cb 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 }}
@Egglestron
Copy link

Thank you so much for this!

@katikus
Copy link

katikus commented Oct 6, 2022

nice example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment