From afc0577b5f9cad87fd783ad60328f1f9013e200c Mon Sep 17 00:00:00 2001 From: Matt Troutman Date: Wed, 2 Oct 2024 12:55:36 -0500 Subject: [PATCH] Adding Script and README.md to the repo --- README.md | 25 +++++++++++++ create repos for fonts.py | 76 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 create repos for fonts.py diff --git a/README.md b/README.md index e69de29..620c362 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,25 @@ +# Repository of Fonts + +This repository contains a collection of fonts that I have found and liked. I have collected them here so that I can easily access them from any computer. They are in the homebrew format for easy installation using homebrew. + +## Prerequisites +You need to have the following installed on your system to use this repository: +- ### 👨🏼‍💻 Xcode Command Line Tools + - ```sh + xcode-select --install + ``` +- ### [🍻 Homebrew](https://brew.sh/) + - ```sh + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + ``` + + +## Installation + +- ```sh + brew tap homebrew/cask-fonts # You only need to do this once! + ``` + +- ```sh + brew install {font-name} // Replace {font-name} with the name of the font you want to install + ``` diff --git a/create repos for fonts.py b/create repos for fonts.py new file mode 100644 index 0000000..c879b92 --- /dev/null +++ b/create repos for fonts.py @@ -0,0 +1,76 @@ +import requests, os + +GITEA_URL = "https://git.trtmn.io" +API_TOKEN = "315d5a6d692eeea061f714725f0d116b819ea62b" +organization = "fonts" + +headers = { + "Authorization": f"token {API_TOKEN}", + "Content-Type": "application/json" +} + +def get_folders_in_folder(path="./font_files"): + return [file for file in os.listdir(path) if os.path.isdir(os.path.join(path, file))] + +folders = ["folder-1", "folder-2", "folder-3", "folder-4", "folder-5"] + +# def make_local_repos(folder_list=folders): +# for folder in folder_list: +# # Create a local folder +# print(f"Creating folder {folder}") +# os.makedirs(folder, exist_ok=True) +# # Create a README.md file in the folder +# with open(f"{folder}/README.md", "w") as f: +# f.write(f"# {folder}\n\nThis is a repo for {folder}") +# #git init +# os.system(f"cd {folder} && git init") +# #git create branch "main" and switch to it +# os.system(f"cd {folder} && git checkout -b main") +# #git add README.md +# os.system(f"cd {folder} && git add README.md") +# #git commit -m "Initial commit" +# os.system(f"cd {folder} && git commit -m 'Initial commit'") +# #git remote add origin +# os.system(f"cd {folder} && git remote add origin {GITEA_URL}/{organization}/{folder}.git") +# #git push -u origin master +# os.system(f"cd {folder} && git push --force -u origin main") + + +# def clone_repos(folder_list=folders): +# for folder in folder_list: +# os.system(f"git clone {GITEA_URL}/{organization}/{folder}.git") + +def add_as_submodule(folder_list=folders): + for folder in folder_list: + os.system(f"git submodule add {GITEA_URL}/{organization}/{folder}.git") + + +def create_repos(folder_list=folders): + for folder in folder_list: + data = { + "name": folder, + "description": f"Repo for {folder}", + "private": False, + "auto_init": True + } + response = requests.post(f"{GITEA_URL}/api/v1/orgs/{organization}/repos", json=data, headers=headers) + if response.status_code == 201: + print(f"Successfully created repo for {folder}") + else: + print(f"Failed to create repo for {folder}: {response.status_code} {response.text}") + +def delete_repos(folder_list=folders): + for folder in folder_list: + response = requests.delete(f"{GITEA_URL}/api/v1/repos/{organization}/{folder}", headers=headers) + if response.status_code == 204: + print(f"Successfully deleted repo for {folder}") + else: + print(f"Failed to delete repo for {folder}: {response.status_code} {response.text}") + + +if __name__ == '__main__': + # create_repos() + # make_local_repos() + # add_as_submodule() + # delete_repos() + print(get_folders_in_folder()) \ No newline at end of file