Skip to content

Instantly share code, notes, and snippets.

View gilangvperdana's full-sized avatar
Still Learning

Gilang Virga Perdana gilangvperdana

Still Learning
View GitHub Profile
dunderrrrrr / GeoIP Block NGINX Ubuntu
Created April 19, 2021 08:28
Allow or block GeoIP in Nginx on Ubuntu 20.04

GeoIP Block NGINX Ubuntu 20.04

Block or filter IPs based on location in Nginx (tested on 1.18.0) on Ubuntu 20.04.

Install Nginx modules

To make use of the geographical filtering, we must first install the Nginx GeoIP module as well as the GeoIP database containing the mappings between visitors’ IP addresses and their respective countries. To do so, let’s execute:

$ sudo apt install libnginx-mod-http-geoip geoip-database
imsmith /
Created April 6, 2021 20:27 — forked from chriswayg/
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
set -o errexit
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1
taoyuan /
Last active July 6, 2024 13:05
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
mjhirst /
Last active June 8, 2023 21:57
Use Cloudflare's API to set Dynamic DNS records with Crontab
# Cloudflare API v.4 Variables
CF_APIKEY='Your API Key Here'
CF_ZONEID='The Zone ID here' # Found on your Cloudflare Dashboard
CF_DNSID='The DNS ID here' # Found by listing DNS with Cloudflare API, see below for command
GET_IP=$(dig +short txt ch whoami.cloudflare @
smijar /
Last active January 9, 2024 17:38
k3d create cluster without traefik and serverlb
# Possibly obsolete: k3d create --name testcls1 --workers 3
k3d create --name testcls1 --workers 3 --server-arg "--no-deploy=traefik" --server-arg "--no-deploy=servicelb"
# UPDATE: in newer versions onwards, this has evolved to (thanks to comments below):
k3d cluster create --k3s-arg "--no-deploy=traefik@server:*"
johnhpatton /
Created January 29, 2020 15:18
Get TCP ephemeral port details to validate ephemeral port exhaustion.
# - netstat - to retrieve network stack details
# - sysctl - to retrieve/modify kernel settings
# - bc - for math
# MIT License
# Copyright 2020 John H Patton, JH Patton Consulting, LLC
sdmoko /
Created November 1, 2019 12:35
Step by step to Monitoring OpenStack Instances with Service Discovery Prometheus and Grafana

Create Instances for Prometheus Server and Grafana

Download Prometheus Server

cd /tmp
wget -c

Extract Prometheus Server

chriswayg /
Last active June 23, 2024 08:13
Ubuntu and Debian Cloud images in Proxmox
phiberoptick / pritunl-server-custom-ssl_manually
Last active April 20, 2024 21:51
Use custom SSL cert in Pritunl Server Community
Ignore all that craziness below. These can be set from the cli with the "pritunl" command.
The commands below can be used to get/set the values of the cert, key, port and if the :80 -> "app.server_port" redirect is active.
# Get current SSL server cert:
pritunl get app.server_cert
# Get current SSL server key:
pritunl get app.server_key
ChuckMichael /
Last active July 1, 2024 10:33
Visual C++ Redistributable Packages