Skip to content

Instantly share code, notes, and snippets.

View serafdev's full-sized avatar
🌍
الله اكبر

فارس بالسرور serafdev

🌍
الله اكبر
View GitHub Profile
@serafdev
serafdev / mariadb-reset-root-password.md
Created November 19, 2024 01:13
Reset the root password for the bitnami deployed mariadb, description in the GIST itself

What??

FIX YOUR MARIADB ROOT PASSWORD

Why??

Because you don't want it broken.

OK

I keep going back to this comment as all bitnami's helm charts have an issue when using ArgoCD with the default username/password for MariaDB where the secret is re-generated everytime.

@serafdev
serafdev / MicroCephSetup.md
Last active July 18, 2024 16:35
MicroCeph with Internal Network Interface

Command on the "master" node

I've had issues where my VM setup has multiple network interfaces but only 1 interface should be used for my nodes to communicate with eachother. MicroCeph kept using the external IP and external subnet during setup, the following command overrides the defaults to use the correct IP (here using the 10.10.103.0/24 subnet to communicate internally)

sudo microceph cluster bootstrap --microceph-ip 10.10.103.218 --mon-ip 10.10.103.218 --public-network 10.10.103.0/24 --cluster-network 10.10.103.0/24

After that simply run the usual microceph init or microceph add-node, the correct IP will be assigned to the token

@serafdev
serafdev / install-docker-armbian.sh
Created August 23, 2023 00:29
Install Docker on Armbian
apt-get remove docker docker-engine docker.io containerd runc
apt-get install ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
@serafdev
serafdev / ghost-blog-backup.sh
Created July 21, 2023 16:17
Script to backup Ghost blog
#/usr/bin/sh
WORKDIR=/home/$USER/ghost
cd $WORKDIR
_date=$(date --iso-8601)
_backup_file_root=./backups/$_date
_backup_file_content=$_backup_file_root/content
@serafdev
serafdev / weird_paths.sh
Created November 1, 2022 15:27
Relative Paths Python
~/Code/test via 🐍 v3.10.7
❯ cat folderA/lib.py
def test():
print("Test")
~/Code/test via 🐍 v3.10.7
❯ cat folderB/folderC/folderD/app.py
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../'))
@serafdev
serafdev / worker.proto
Created September 5, 2022 11:34
Proto File
syntax = "proto3";
package worker;
option go_package="seraf-worker/workerpb";
message WorkerRequest {
string crazy_work = 1;
}
message WorkerResponse {
@serafdev
serafdev / collection_as_param.py
Created July 27, 2022 18:04
Collection as Parameter - Python
from typing import List
import random
def f(x: List[int] = []) -> List[int]:
"""
Function that appends 1 random int to List x.
If no list is passed, returns a List with 1 element.
@serafdev
serafdev / limitWorkers.go
Last active November 26, 2020 00:50
Simplest way to limit number of concurrent go routines in a continuous feed
package main
import (
"fmt"
"time"
)
func main() {
ch := make(chan struct{}, 5)
@serafdev
serafdev / helm-del-all.sh
Created November 21, 2020 01:38
Delete all Helm Releases in the default namespace
#!/bin/sh
# Delete all Helm Releases in the default namespace
helm list | awk 'NR>1{print $1}'| xargs helm del
@serafdev
serafdev / sed.sh
Created November 20, 2020 19:19
Replace oldString with newString in all files in folder and nested folders
#!/bin/sh
# Replace oldString with newString in all files in folder and nested folders
grep -rl "oldString" /your/path | xargs sed -i '' -e "s/oldString/newString/g"