sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
Add yourself to the docker
group to be able to run containers as non-root (see Post-install steps for Linux).
# To permanently cache the credentials | |
git config --global credential.helper store | |
# To ignore files that could cause issues across different workspaces | |
touch .gitignore | |
echo ".obsidian/cache | |
.trash/ | |
.DS_Store" > .gitignore |
To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
def upsert(session, model, rows): | |
table = model.__table__ | |
stmt = postgresql.insert(table) | |
primary_keys = [key.name for key in inspect(table).primary_key] | |
update_dict = {c.name: c for c in stmt.excluded if not c.primary_key} | |
if not update_dict: | |
raise ValueError("insert_or_update resulted in an empty update_dict") | |
stmt = stmt.on_conflict_do_update(index_elements=primary_keys, |
# Instructions | |
# 1. Update your /etc/hosts file... | |
# > 127.0.0.1 gitea drone | |
# 2. Run gitea + gitea-db and generate the oauth application | |
# > docker-compose -p gitea-drone up gitea gitea-db | |
# - Navigate to http://gitea:3000 to finish the installation and register a user | |
# - Create a oauth application as described here: https://docs.drone.io/installation/providers/gitea/ | |
# - Set the Redirect uri to http://drone:8000/login | |
# 3. Update the docker-compose file with the client_id and client_secret | |
# 4. Fire up all of the services |
This environment is dependent off a common network for docker/git plugin and gitea-server, so for this work fine in closed networks we have to create a custom network before run this composefile.
First create your network:
docker network create gitea-network
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |