This repository contains a collection of Python scripts that I gathered through out the years.
- admin/
- ai/
- ntnu/
- Bind-1_Horte-jeg-riktig/
- organize_repo/
- admin/
- GLOSSARY.md
- README.md
[This overview has been generated automatically.]
Used to organize «dagbok» repos.
These repositories typically include memories from specific time periods or, to a lesser degree, certain topics or events like shootings, exhibitions, etc. Memories take form as text, pictures, haikus, as well as some gifs, video files, and audio files.
organize_repo includes functions:
- Organize memories mostly structured by date.
- Organize, update, and extract tags, including creating a glossary.
- Add text and other content to files.
- Add links to media files like images, gifs and videos.
The function is used as follows:
python organize_repo \path\to\repository [ … options … ]
As of 2025-09-22, organize_repo has the following options:
usage: A command line script to organize a git repository containing images organized by year, month, and day.
[-h] [-f] [-i] [-a] [-tb]
[-c] [-w NEW_WEEK] [--new_entry] [--alt_file]
[--new_repo] [--update_admin] [--register] [--lookup]
[-tg] [--replace_tg] [--expand_tg] [--local]
[--history] [--status] [--pull] [--push] [--add_remote] [-n REPO_NAME] [-g GROUP] [-p [{SSH,HTTPS}]]
[--convert_webp [{JPEG,PNG}]]
path
positional arguments:
path/to/repository Path to the target git repository.
options:
-h, --help show this help message and exit
Operations related to the organization of content:
-f, --force Forces the recomputation of the JSON.DUMP file. Default: False
-i, --image Find all new image files in the repo and presenting them on the page. Default: False
-a, --audio Find all new audio files in the repo and presenting them on the page. Default: False
-tb, --tables Create image tables. Default: False
Operations related to content creation:
-c, --commit Committing changes in existing files. Adding and committing new files. Default: False.
-w NEW_WEEK, --new_week NEW_WEEK
Create new week file.
--new_entry Add new entry under a specific header in a chosen file. You will be asked for a header and
text by input prompt. If a date is chosen, it will be added to a default week file, unless
the alt_file flag is raised as well. Default: False
--alt_file Choosing alternative file for new entry. Only relevant if date is chosen during the new
entry function. Default: False
Operations related to admin functions.:
--new_repo Create a new git repository. Default: False.
--update_admin Update admin related files. Default:False
--register Register a parent or child repository. Default: False.
--lookup Update lookup file which is used to direct from one file to (an)other(s). Default: false
Operations related to tags:
-tg, --tags Update all tags in the repository. Default: False
--replace_tg Replace tags with entries from the tag replacement files. Default: False
--expand_tg Expand tags with entries from the tag replacement file. Default: False
--local Should tags replacement be saved as typos. Default: False
Operations related to git commands:
--history Checks git history. Default: False.
--status Checks git changes for GitHub( and GitLab). Default: False.
--pull Pulls the commited git changes from GitHub( and GitLab). Default: False.
--push Pushes the commited git changes to GitHub( and GitLab). Default: False.
--add_remote Add remote git origin to GitHub( and GitLab). Default: False.
-n REPO_NAME, --repo_name REPO_NAME
Repository name.
-g GROUP, --group GROUP
Group/organization name.
-p [{SSH,HTTPS}], --protocol [{SSH,HTTPS}]
Protocol of the repository (https or ssh)
Miscellaneous operations:
--convert_webp [{JPEG,PNG}]
Converts WEBP into target file
--process_gbcam [{GIF,BMP}]
Process BMP images from the Game Boy Camera
--resize [{JPEG,PNG}]
Resizes images that have dimensions greater than 1024, and thumbnaisl that have dimensions greater than 128.
-f, --force forces the computation of a new DUMP.json file. This will also initiate the computation of the glossary, as well as the ordering of sections.
The scripts allows for certain admin operations related to the glossary, section ordering, and header management.
The glossary computation checks the number of tags present in the repository and its children:
- If the number of tags is equal to or less than 333, an easy glossary is computed: all tags and links are presented on a single glossary page, which also contains a high score list of the most common tags..
- If the number of tags is greater than 333, a complex glossary is computed: each letter of the alphabet receives its own file in the glossary repository, which the main glossary file links to. Apart from these links, the main glossary file only contains a high score list of the most common tags.
Each content file is represented as a key in the dictionary stored in ORGANISATION.md. The value for each key is a list of headers that defines the desired section order for that file.
- If the list for a key is empty, the current order of headers in the content file is stored in the list.
- If new headers are present in the content file but not in ORGANISATION.md, the list is updated to reflect the order in the content file.
- If existing headers are present in both files but the order differs, the content file will be overwritten to match the order specified in ORGANISATION.md.
- When new images are added to a content file, the default section order is taken from the TITLES file, if available.
To edit a header while preserving its position, use the \new\ command: # old_title\new\new_title
To delete a section, use the \del\ command: # old_title\del\
These commands can be added to either ORGANISATION.md or the content file.
The script supports several image-related operations, including WEBP conversion, Game Boy Camera image processing, and resizing.
When this option is selected, the script scans the entire repository for .webp images. These images are converted to the chosen format (e.g., JPEG or PNG). JPEG is used as the default output format.
When this option is selected, the script processes original BMP images from the Game Boy Camera that are correctly marked (e.g., with gbcam in the file name). It checks whether a larger version of the image exists with the same filename. If not, the script uses the original BMP image as a thumbnail and creates a larger version (twice the size) in the chosen format (e.g., GIF or BMP). GIF is used as the default output format.
This functionality currently supports Game Boy Camera images from Joey Jr. using BMP format. Support for original Game Boy Camera images from Epilogue (which use PNG) is not yet implemented.
When this option is selected, the script scans the entire repository for image files and checks their dimensions.
- Regular images with any dimension exceeding 1024 px are flagged for resizing.
- Thumbnails with any dimension exceeding 128 px are also flagged for resizing.
- Thumbnails that are not exactly 128×128 px will be flagged for information.
- The user is prompted to decide, image by image, whether resizing should be performed.
Introduksjon for installasjon av spaCy kommer fra denne siden.
På Windows
pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm
python -m spacy download de_core_news_sm
python -m spacy download nb_core_news_sm