Skip to content

Instantly share code, notes, and snippets.

@sasajib
sasajib / backup.sh
Created August 15, 2024 13:42 — forked from Meldiron/backup.sh
Backup and Restore Appwrite, the lazy way 🐌
# Make sure to stop Appwrite before this backup,
# and make sure you have enough space on the machine.
# After backing up, make sure there is a file in 'backups/backup-___.tar.gz'.
# Also please check size of this file, it should be at least 5kb, even for small instances.
docker run --rm \
-v appwrite_appwrite-mariadb:/backup/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup/appwrite-redis \
-v appwrite_appwrite-cache:/backup/appwrite-cache \
@sasajib
sasajib / k3s_helm_install.sh
Created May 16, 2024 19:55 — forked from icebob/k3s_helm_install.sh
K3S + Helm installing
# Install K3S
curl -sfL https://get.k3s.io | sh -
# Copy k3s config
mkdir $HOME/.kube
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config
sudo chmod 644 $HOME/.kube/config
# Check K3S
kubectl get pods -n kube-system
export class Either<L, R> {
constructor(private left: L | null, private right: R | null) {}
static left<L, R>(value: L): Either<L, R> {
return new Either<L, R>(value, null);
}
static right<L, R>(value: R): Either<L, R> {
return new Either<L, R>(null, value);
}

terraform illustration

Introduction

Terraform is primarily known and used as an "infrastructure as code" (IaC) tool, and it excels in that specific domain. Its role and usage can be broken down into several key areas:

  1. Infrastructure Provisioning: Terraform's main strength is provisioning infrastructure. This means using code to create, modify, and destroy the physical (e.g., servers, networks) or virtual (e.g., VMs) resources that your applications need to run. It can do this across cloud providers (like AWS, Google Cloud, Azure) or on-premises (via VMware, OpenStack).

  2. Platform Agnostic: One of Terraform's major benefits is that it allows you to manage infrastructure across different cloud providers, using the same language and similar concepts. This prevents vendor lock-in and promotes reusable practices.

@sasajib
sasajib / install.sh
Created May 18, 2023 10:07 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@sasajib
sasajib / RcloneMountService.md
Last active January 30, 2023 10:43 — forked from kabili207/Rclone systemd service.md
Rclone systemd user service

rclone systemd service

Preparation

This service will use the same remote name you specified when using rclone config create. If you haven't done that yet, do so now.

Next, create the mountpoint for your remote. The service uses the location ~/mnt/<remote> by default.

mkdir ~/mnt/dropbox

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

Installing PowerDNS with SQLite3 and Enabling the Backend Service

PowerDNS is a widely used DNS server software that can be configured to use different backends, including SQLite3. In this article, we will show you how to install PowerDNS with SQLite3 on Ubuntu 22.04 and enable the backend service.

# note: become root or use sudo

Step 1: Configure DNS

'systemd-resolved' conflict with port 53, The first step is to configure the DNS settings in the file.

@sasajib
sasajib / dummy-web-server.py
Created November 3, 2022 11:58 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@sasajib
sasajib / extract.py
Created October 26, 2022 10:46 — forked from tyndyll/extract.py
Parsing Maildir Mail Stored on Disk with Python
def unicode_it(data):
# Take a string of data and convert it to unicode
try:
return unicode(data, errors="replace").strip()
except TypeError as E:
return u""
def extract(msg, msg_obj, attachments):
if msg.is_multipart():
for part in msg.get_payload():