Skip to content

Instantly share code, notes, and snippets.

@armsultan
armsultan / user-data
Last active March 30, 2025 22:27
user-data for my raspberry pi k3s cluster
#cloud-config
# This is the user-data configuration file for cloud-init. By default this sets
# up an initial user called "ubuntu" with password "ubuntu", which must be
# changed at first login. However, many additional actions can be initiated on
# first boot from this file. The cloud-init documentation has more details:
#
# https://cloudinit.readthedocs.io/
#
# Some additional examples are provided in comments below the default
# configuration.
@armsultan
armsultan / cmdline.txt
Last active March 30, 2025 22:27
cmdline.txt
console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=writable rootfstype=ext4 rootwait fixrtc quiet splash cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
@armsultan
armsultan / generate-ssh-key.sh
Created March 2, 2022 21:27 — forked from denisgolius/generate-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@armsultan
armsultan / loadgen.sh
Created January 5, 2022 16:09
Daily variable load generator using wrk2
#!/usr/bin/env bash
#
# HOW TO:
#
# 1. Create this script and place it in /bin/loadgen
# 2. Make script executable: chmod +x /bin/loadgen
# 3. Install wrk2 (https://github.com/giltene/wrk2) so we can define Rate -R, --rate:
# See install instructions: https://github.com/giltene/wrk2/wiki/Installing-wrk2-on-Linux
# 4. Install bc, the command-line calculator:
# apt-get install bc
@armsultan
armsultan / self-signed-ssl.sh
Last active June 30, 2021 21:53
Script to create self-signed CA certificates, WILDCARD server certificates, and client certificates for Non-Production testing
#!/usr/bin/env bash
# How to use
# 1. Make this script executable:
# chmod +x ./self-signed-ssl.sh
# 2. Run script and provide domain name:
# ./self-signed-ssl.sh mydomain.com
# print usage
@armsultan
armsultan / nginx-manager-https.conf
Last active June 21, 2021 14:37
nginx-manager-https.conf
# nginx-manager-https.conf
# * This config is disabled when `.disabled` is appended to file, i.e nginx-manager-noauth-https.conf.disabled
# * HTTP 301 redirect to HTTPS
# * Proxy UI/API with no auth to 127.0.0.1 on nginx-manager
# * Include nginx-manager-upstreams.conf for the proxy_pass to work
# To enable this HTTPS Config:
# * Make sure your crt, key and dhparams exist per the config
# * Disable nginx-manager-noauth-http.conf by removing file or rename the file to end with anything other than `.conf`
# e.g., `nginx-manager-noauth-http.conf.disabled`
# * Remove `.disabled` from the filename, i.e nginx-manager-noauth-https.conf.disabled > nginx-manager-noauth-https.conf
@armsultan
armsultan / nginx-manager-upstreams.conf
Created June 20, 2021 22:41
nginx-manager-upstreams.conf
# nginx-manager-upstreams.conf
# * Upstreams for NGINX nginx-manager API/UI
upstream nginx-manager_servers {
zone nginx-manager_servers 64k;
server 127.0.0.1:11000;
keepalive 64;
}
# vim: syntax=nginx
@armsultan
armsultan / nginx-manager-upstreams-grpc.conf
Created June 20, 2021 22:40
nginx-manager-upstreams-grpc.conf
# nginx-manager-upstreams-grpc.conf
# * Upstreams for NGINX nginx-manager GRPC
upstream nginx-manager_grpc_servers {
zone nginx-manager_grpc 64k;
server 127.0.0.1:10000;
}
# vim: syntax=nginx
@armsultan
armsultan / status_api.conf
Created June 20, 2021 22:39
status_api.conf
# This sample NGINX Plus configuration enables the NGINX Plus API, for live
# activity monitoring and the built-in dashboard, dynamic configuration of
# upstream groups, and key-value stores. Keep in mind that any features
# added to the API in future NGINX Plus releases will be enabled
# automatically by this file.
# Created in May 2018 by NGINX, Inc. for NGINX Plus R14 and later.
# Documentation:
# https://docs.nginx.com/nginx/admin-guide/monitoring/live-activity-monitoring/
# https://www.nginx.com/blog/live-activity-monitoring-nginx-plus-3-simple-steps
@armsultan
armsultan / nginx-manager-grpc.conf
Last active June 24, 2021 16:10
nginx-manager-grpc.conf
# nginx-manager-grpc.conf
# * Proxy grpc through tcp 10443 to 127.0.0.1 on nginx-manager
# * Can have TLS/SSL added
# * Replace 10002 with the port you want to use externally
log_format grpc_json escape=json '{"timestamp":"$time_iso8601","client":"$remote_addr",'
'"uri":"$uri","http-status":$status,'
'"grpc-status":$grpc_status,"upstream":"$upstream_addr"'
'"rx-bytes":$request_length,"tx-bytes":$bytes_sent}';