<commit_before><commit_msg>Adding UUID.<commit_after>---
title: VirtualBox After Clone
tags:
  - uuid
  - python
  - kernel
  - sh
categories:
  - notes
header:
  overlay_color: "#000"
  overlay_filter: "0.5"
  overlay_image: /assets/the-most-terrifying.png
excerpt: Various ways of generating UUID
---

There are ways of creating UUID.


# From kernel

Directly from kernel

```
UUID=$(cat /proc/sys/kernel/random/uuid)
```

# From Python

Creating version 4 UUID. (Change 4 to 1 if you want version 1)

```
UUID=$(python  -c 'import uuid; print uuid.uuid4()')
```

# From Random numbers

From random numbers.

```
UUID=$(od -x /dev/urandom | head -1 | awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}')
```

{'fraction_non_alphanumeric': 0.16216216216216217, 'fraction_numerical': 0.02702702702702703, 'mean_word_length': 3.5714285714285716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4759302', 'n_tokens_mistral': 273, 'n_tokens_neox': 257, 'n_words': 75}