Advanced Search
Search Results
47 total results found
Technical
Bash
Files
Manipulating files with tools
Matrix
Working with the Matrix Network
Linux
Docker
Bread
Meat
Date & Time
File Operations
Media Repository
Working with 3rd party Matrix Media Repository
Snippets
A collection of (!)useful chunks to get things done..
Arch
Git
NixOS
SystemD
Dates
date +'%Y-%m-%d' 2023-02-28 date --date='2 days ago' +'%Y-%m-%d' 2023-02-26 date +'%s' 1677607151 date --date @1677607151 +'%Y-%m-%d.%H:%M:%S %Z' 2023-02-28.09:59:11 PST
Time Elapsed
start_time=$(date +'%s') sleep 5 end_time=$(date +'%s') total_time="$(echo $((end_time-start_time)))" echo "${total_time}" | awk '{printf "%dh%02dm%02ds", $1/3600, ($1/60)%60, $1%60}' 0h00m05s
Delete older than..
Find directories and delete recursively find /path/ -mtime +7 -type d -exec rm -rf {} + Find files and delete recursively find /path/ -mtime +7 -type f -exec rm -rf {} +
Variables
Uppercase VAR="vaRiAbLe" echo "Uppercase ${VAR^^}" VARIABLE Lowercase echo "Lowercase ${VAR,,}" variable First Letter Capitalized echo "First Letter Capitalized: ${VAR^}" Variable
JSON
XML
YAML
Scratchpad 1 yq -n ' .listeners =[ { "type": "http", "port": 8080, "tls": false, "x_forwarded": false, "resources": "foo" ...
Import / Export
Export Data from Synapse Make sure that there is access to the Synapse DB and the Synapse media_store mkdir -p /tmp/export export_synapse_for_import \ -ServerName synapse.example.com \ -destination /tmp/e...
Gitlab
Working with the API Get CSV of all open issues on instance #!/bin/bash TOKEN=get_your_token URL=https://your.gitlab.instance.tld/ PAGE=1 while [ "${PAGE}" -lt "50" ] ; do curl --header "PRIVATE-TOKEN: ${TOKEN}" "${URL}/api/v4/issues?scope=all&state=opene...
Web
Working with remote APIs Check status of a website that is locked behind an authorization cookie. #!/bin/bash ### authenticate() { headers=$(mktemp) authenticate_response=$(curl -sSL -D $headers \ -H "Accept: ...
Rebuild Python Packages
When new versions of python is released there are packages that are needing to be rebuilt. yay -S $(pacman -Qoq /usr/lib/python3.10) --answerclean All
Migrate Github Repository to Gitea
GITHUB_AUTH_TOKEN=1234 GITEA_AUTH_TOKEN=5678 GITEA_URL=https://git.example.com _payload=$(mktemp) cat <<EOF > ${payload} { "auth_token": "${GITHUB_AUTH_TOKEN}", "clone_addr": "https://github.com/tiredofit/$1.git", "issues": true, "pull_requests": true, "priv...
Installing NixOS (Encrypted BTRFS Impermanance)
Intro This details the steps to create a LUKS encrypted BTRFS NixOS installation with impermanance, only keeping the settings that are required in between reboots. Features: UEFI Boot w/GRUB Encrypted Btrfs File System with hourly snapshots on /home and /var/...
Creating BTRFS Disk Snapshots
The following shows two alternate ways to be performing BTRFS snapshots on a NixOS system. First - a look at how the disk is setup: Disk Setup # /etc/fstab /dev/disk/by-uuid/1234567890-abcdef-0987654321-fedcba /home btrfs subvol=home/active,compress=zstd,noat...
OnCalendar / Timer examples
Frequency Code Every Minute *-*-* *:*:00 Every 2 minute *-*-* *:*/2:00 Every 5 minutes *-*-* *:*/5:00 Every 15 minutes *-*-* *:*/15:00 Every quarter hour *-*-* *:*/15:00 Every 30 minutes *-*-* *:*/30:00 Every half an hour *-*-* *:*/30:00 E...
Home Manager Setup
Manage user environments with Home Manager Manage personal configuration files and profiles with Home Manager, similar to the way that system configuration is performed, but don't require users to have root access. This is a work in progress. TODO Optimize p...
Writing Scripts in Nix
Create executible shell script writeShellScriptBin # custom-script.nix { pkgs, config, ...}: let custom_script = pkgs.writeShellScriptBin "script_name" '' function() { if [ -n "$1" ] ; then echo $1 fi } ''; in { ho...
Secrets Management
Managing secrets with SOPS-Nix. Install NixOS Subset of flake.nix # flake.nix { inputs = { sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = inputs@{ sops-nix, ... }: { ni...
Setup Docker Swarm
This is a guide on setting up the NG Network Prequisites Working VPN (Tailscale/Headscale) allowing ESP In order to use an encrypted overlay network Headscale must be configured to allow ESP (Protocol 50) through its tunnel. Sample ACL: "acls": [ ...
Installing NixOS on Raspberry PI 3B
This is assumed that you already have access to a running NixOS System - We'll be using a NixOS system to do the building of packages and copying the changes over via SSH as the SOC is just so underwhelming.. Initial Configuration Download SD Image from Hydra...