Skip to content

Instantly share code, notes, and snippets.

View hobroker's full-sized avatar
🐾

Igor Leahu hobroker

🐾
View GitHub Profile
@hobroker
hobroker / group-each.sh
Created December 13, 2021 21:25
Group files in a year each x months (default 4)
#!/usr/bin/env bash
#
# Usage: group.sh target_directory 4
# Result:
# target_directory/part1of3/...files from January till April (inclusive)
# target_directory/part2of3/...files from May till August
# target_directory/part3of3/...files from September till December
#
set -e
@hobroker
hobroker / install_k3s.sh
Last active January 31, 2022 10:18
Install k3s
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--no-deploy traefik --disable traefik --kube-apiserver-arg service-node-port-range=1-60000 --write-kubeconfig-mode 644 --write-kubeconfig /path/to/.kube/config --tls-san PUBLIC_IP_HERE " sh -s -
us04logfiles.zoom.us
@hobroker
hobroker / enc.sh
Created January 7, 2023 20:06
Create/edit/encrypt/decrypt a file with a password
#!/usr/bin/env bash
FILE=$1
FILE_ENC="$FILE.enc"
encrypt() {
openssl enc -aes-256-cbc -e -in "$FILE" -out "$FILE_ENC" -pass "pass:$PASS"
}
decrypt() {
@hobroker
hobroker / 1-formatting.md
Last active February 19, 2025 11:10
C++ Code Formatting

1. Indentation and Whitespace

a. Consistent Indentation

  • Choose an indentation size: Common choices are 2 or 4 spaces. Some styles use tabs, but spaces are generally more consistent across editors.
  • Indent each new code block: Inside any set of { }, increase the indentation level by one. When you exit that block, decrease the indentation level.

Example (indenting 4 spaces):