Skip to content

Instantly share code, notes, and snippets.

View grenade's full-sized avatar

rob thijssen grenade

View GitHub Profile
@grenade
grenade / random-wallpaper.sh
Last active April 25, 2024 10:48
create gnome wallpaper with different random images for each screen
#!/usr/bin/env bash
work_dir=/tmp/random-wallpaper
lite_archive_url=https://unsplash.com/data/lite/latest
lite_archive_path=${work_dir}/unsplash-research-dataset-lite-latest.zip
photos_tsv_archive_path=photos.tsv000
photos_tsv_path=${work_dir}/photos.tsv
photos_tsv_dir_path=$(dirname ${photos_tsv_path})
declare -a screens=(3840x2160 3840x2160 1920x1080)
@grenade
grenade / global-set-cloudflare-dns.sh
Last active November 5, 2023 11:29
set all wifi connections to use cloudflare dns
(
IFS=$'\n'
for line in $(nmcli --fields UUID,TYPE,NAME connection show); do
conn_uuid=$(echo ${line} | cut -d ' ' -f 1)
conn_type=$(echo ${line} | cut -d ' ' -f 3)
conn_name=$(echo ${line} | cut -d ' ' -f 4- | xargs)
if [ "${conn_type}" = "wifi" ]; then
echo "name: $(tput bold)${conn_name}"
echo "$(tput dim)uuid: ${conn_uuid}, type: ${conn_type}"
nmcli connection modify ${conn_uuid} ipv4.dns "1.1.1.1,1.0.0.1"
@grenade
grenade / 00-coyote-mongo-sync-readme.md
Last active May 12, 2023 13:27
migrate and sync a live mongo database to a new cluster deployment

coyote

a systemd service for migrating a live atlas cluster to a self-hosted cluster

coyote uses mongodump and mongorestore to perform:

  • a point in time restore (pitr) of a live source cluster to a new target cluster
  • subsequent source operation log replays on the target, in perpetuity, to keep target synced with source until the source goes offline
@grenade
grenade / install-compass-fedora.sh
Created February 7, 2023 08:37
install mongodb compass 1.35 on fedora 37
#!/usr/bin/env bash
# usage: curl -sL https://gist.github.com/grenade/9c18bc9eb354c20ca483024c1965bc6e/raw/install-compass-fedora.sh | bash
sudo curl -Lo /etc/yum.repos.d/mongodb.repo https://gist.github.com/grenade/9c18bc9eb354c20ca483024c1965bc6e/raw/mongodb.repo
sudo dnf update
sudo dnf install mongodb-mongosh mongodb-database-tools mongodb-org-tools
sudo dnf install https://downloads.mongodb.com/compass/mongodb-compass-1.35.0.x86_64.rpm
[
{
"бг": {
"аз вземам": {
"аз": "аз ще взема",
"ти": "ти ще вземеш",
"той": "той ще вземе"
}
},
"en": {
bg en
Аз вземам I take
Аз ще взема I will take
Ти ще вземеш You will take
Той ще вземе He will take
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
# path_prefix: /tmp/loki
# storage:
# filesystem:
@grenade
grenade / fetch-ec2-pricing.sh
Last active November 30, 2023 15:00
fetch aws ec2 pricing data for on-demand, license free, instances
#!/usr/bin/env bash
# usage: curl -sL https://gist.github.com/grenade/b03edb28bba5d3542a6b50b742318061/raw/fetch-ec2-pricing.sh | bash
# csv filenames
raw_path=/tmp/ec2.csv
machine_path=/tmp/machine.csv
price_path=/tmp/price.csv
region_path=/tmp/region.csv
@grenade
grenade / dns-ip-sync.service
Last active February 7, 2024 07:21
diy dynamic dns - sync cloudflare domain name with dynamic ip address every 60 seconds
[Unit]
Description=dns ip sync
Wants=network-online.target
After=network-online.target
AssertPathExists=/etc/dns-ip-sync.json
[Service]
Type=simple
ExecStartPre=curl \
--silent \
@grenade
grenade / pwg.md
Created December 16, 2021 06:29
generate pragmatic passwords that are also secure

add to ~/.bashrc to have a password generator that:

  • removes problematic characters
  • always starts and ends with an english alphabet character
  • is of configurable length
pwg() {
  case ${1} in
    ''|*[!0-9]*) password_length=12 ;;
    *) password_length=${1} ;;