Skip to content

Instantly share code, notes, and snippets.

@LeXofLeviafan
Last active August 24, 2024 16:24
Show Gist options
  • Save LeXofLeviafan/47def9c55ee9107680e7790c86e07453 to your computer and use it in GitHub Desktop.
Save LeXofLeviafan/47def9c55ee9107680e7790c86e07453 to your computer and use it in GitHub Desktop.
A generated bukuserver database for testing purposes (use `buku -i` to import the file)
@LeXofLeviafan
Copy link
Author

Script to generate a DB like this:

#!/usr/bin/env python
from random import randint, choice
from sys import argv

WORDS = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault',
         'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud']
PRODUCT = len(WORDS) ** 3  # amount of combinations

if __name__ == '__main__':
    try:    num = int(argv[1])
    except: num = 1000
    for i in range(1, num+1):
        if randint(1, PRODUCT) <= 3:
            print(f' * [[javascript://void({i})]]')
        else:
            words = [choice(WORDS) for j in range(3)]
            name, tags, netloc = (sep.join(words) for sep in [' ', ':', '.'])
            print(f' * [[https://{netloc}/{i}][{name}]] :{tags}:')

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