Skip to content

Instantly share code, notes, and snippets.

@garygan89
garygan89 / rclone_mount_for_plex
Created August 7, 2020 22:36
rclone mounting command for gdrive on seedbox
# rclone mount command with optimal settings for Plex on Gdrive using VFS.
rclone mount gcrypt: ~/mnt/gdrive --allow-other --allow-non-empty --cache-db-purge --buffer-size 128M --use-mmap --dir-cache-time 72h --drive-chunk-size 256M --timeout 1h --vfs-cache-mode writes --vfs-read-chunk-size 128M --vfs-read-chunk-size-limit 1G --no-modtime
@garygan89
garygan89 / hwtest.sh
Created August 11, 2020 21:56
Hardware test on Solidrun Hummingboard Pulse.
#!/bin/bash
# Hardware test on Solidrun Hummingboard Pulse.
#usage: hwtest [log]
# --------------------------------------------------------------------------------
black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3);
blue=$(tput setaf 4); magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7);
on_red=$(tput setab 1); on_green=$(tput setab 2); on_yellow=$(tput setab 3); on_blue=$(tput setab 4);
on_magenta=$(tput setab 5); on_cyan=$(tput setab 6); on_white=$(tput setab 7); bold=$(tput bold);
dim=$(tput dim); underline=$(tput smul); reset_underline=$(tput rmul); standout=$(tput smso);
reset_standout=$(tput rmso); normal=$(tput sgr0); alert=${white}${on_red}; title=${standout};
@garygan89
garygan89 / kubernetes-prometheusRule-withnamespacelabel.yaml
Created March 21, 2021 21:17
Kubernetes Prometheus Rule with added namespace label 'monitoring' so that they can be received by custom receivers.
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
app.kubernetes.io/component: exporter
app.kubernetes.io/name: kube-prometheus
app.kubernetes.io/part-of: kube-prometheus
prometheus: k8s
role: alert-rules
name: kubernetes-rules
@garygan89
garygan89 / install-essentials-utils.sh
Last active May 16, 2021 05:27
Script that install utilities to run on newly setup dedicated server
#!/bin/bash
# General Config
SSH_PORT=1022
TIMEZONE="America/New_York" # run timedatectl list-timezones | egrep -o "Asia/B.*" to get the list
# File system tools
sudo apt install lvm2
# Networking tools
sudo apt install vnstat bwm-ng -y
@garygan89
garygan89 / autorclone.py
Created May 17, 2021 04:48
Autorclone modified to support easy rclone copy config. Original autorclone repo: https://github.com/xyou365/AutoRclone
import os
import json
import time
import glob
import psutil
import logging
import subprocess
import configparser
import filelock
@garygan89
garygan89 / kubernetes-prometheusRule-noKubeSchedulerController-withnamespacelabel.yaml
Created May 19, 2021 23:39
Kubernetes Prometheus Rule without KubeScheduler and KubeController rules, and with namespace 'monitoring' added so that alertmanager custom receiver can receive the alerts.
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
app.kubernetes.io/name: kube-prometheus
app.kubernetes.io/part-of: kube-prometheus
prometheus: k8s
role: alert-rules
name: kubernetes-monitoring-rules
namespace: monitoring
@garygan89
garygan89 / .bashrc
Last active May 30, 2021 20:45
Bashrc for shorthand kubectl and etcd for k3s setup.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@garygan89
garygan89 / start_rclonewebgui.md
Last active June 1, 2021 21:21
Start Rclone Web GUI

Used command line for years now, only to know the web GUI exist ! This is great to monitor stuffs that are ongoing instead of having to tmux into each rclone instance to know the progress. I still use Autorclone with my Google SA account to bypass the 750GB limit.

Start rclone web gui on Windows

.\rclone.exe rcd --rc-web-gui --rc-user admin --rc-pass password --rc-serve --rc-web-gui-no-open-browser

Start rclone web gui on Linux

rclone rcd --rc-web-gui --rc-user admin --rc-pass password --rc-serve --rc-web-gui-no-open-browser
@garygan89
garygan89 / helloworldk8s.yaml
Last active June 14, 2021 18:51
Hello World for k8s
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: hello-world