Skip to content

Instantly share code, notes, and snippets.

View revant's full-sized avatar

Revant Nandgaonkar revant

View GitHub Profile
@revant
revant / mqtt.js
Last active June 18, 2024 05:37
MQTT Sub nodejs
const mqtt = require("mqtt");
const client = mqtt.connect("mqtt://event-bus:1883", {
clientId: "clientId",
clean: true,
connectTimeout: 4000,
username: 'emqx',
password: 'public',
reconnectPeriod: 1000,
});
client.on('connect', () => {
@revant
revant / smtp.py
Last active November 3, 2023 14:18
Python SMTPServer
# https://github.com/frappe/frappe/blob/develop/frappe/email/smtp.py
import smtplib
class SMTPServer:
def __init__(
self,
server,
login=None,
password=None,
def terminal_websocket(name: str, namespace: str, command: list[str], container: str = None):
load_config()
core_v1_api = client.CoreV1Api()
resp = stream(
core_v1_api.connect_get_namespaced_pod_exec,
name=name,
namespace=namespace,
container=container,
command=command,
stderr=True,
@revant
revant / README.md
Last active December 14, 2022 17:23
gcloud in container

Start Container:

docker run --rm -it \
  -v $PWD/data/gcloud:/root \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e "TERM=xterm-256color" google/cloud-sdk:alpine sh

Prepare Container:

@revant
revant / README.md
Last active November 27, 2022 07:33
Frappe/ERPNext version 14 on RHEL 8

Download and install offline

# for centos:8 docker container refer https://stackoverflow.com/a/70930049
# yumdownloader --assumeyes --destdir=$HOME/downloads/rpms --resolve {package-name}
sudo yum install -y --cacheonly --disablerepo=* $HOME/downloads/rpms/*.rpm
# Following command needs Python 3.10 installed. Refer Section below
sudo pip3.10 install --no-index --find-links file:$HOME/downloads/pip frappe-bench 
@revant
revant / pwd.yml
Last active January 7, 2023 14:30
ERPNext version-14 Play With Docker
version: "3"
services:
backend:
image: frappe/erpnext:v14.12.0
deploy:
restart_policy:
condition: on-failure
volumes:
- sites:/home/frappe/frappe-bench/sites
@revant
revant / backup.sh
Created April 20, 2022 08:46
MariaDB Backup + Restic
# Video: https://youtu.be/b-KFj8GfvzE
# Full Backup
mariadb-backup --backup \
--user=$DB_ROOT_USER \
--password=$DB_ROOT_PASSWORD \
--target-dir=$BACKUP_BASE_DIR
# Incremental Backup
mariadb-backup --backup \
--user=$DB_ROOT_USER \
@revant
revant / README.md
Last active November 29, 2023 11:23
ERPNext on Docker Swarm
@revant
revant / backup-with-restic-and-s3.md
Last active September 6, 2023 14:46
backup with restic and S3

For local example, start MinIO

docker run \
  -p 9000:9000 \
  -p 9001:9001 \
  --name localminio \
  -v ~/minio/data:/data \
  -e "MINIO_ROOT_USER=AKIAIOSFODNN7EXAMPLE" \
  -e "MINIO_ROOT_PASSWORD=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
@revant
revant / docker-compose.yml
Last active November 8, 2022 07:47
OpenCart Docker Compose
version: '2'
services:
mysql:
image: docker.io/bitnami/mysql:5.7.36
environment:
- MYSQL_ROOT_PASSWORD=123
- MYSQL_USER=opencartuser
- MYSQL_DATABASE=opencartdb
- MYSQL_PASSWORD=opencart
volumes: