Skip to content

Instantly share code, notes, and snippets.

@maruno
Created March 9, 2015 16:52
Show Gist options
  • Save maruno/55f3f19d49300cb324ea to your computer and use it in GitHub Desktop.
Save maruno/55f3f19d49300cb324ea to your computer and use it in GitHub Desktop.
CF UUID
#!/usr/bin/env python
import sys
import uuid
def create_cf_uuid(uuid_str=None):
"""
Go from 8-4-4-4-12 to 8-4-4-16
"""
if not uuid_str:
uuid_str = str(uuid.uuid4())
uuid_str = uuid_str.upper()
a = uuid_str.split('-')
return "-".join(a[:4]) + a[-1]
print(create_cf_uuid())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment