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
dunderrrrrr / GeoIP Block NGINX Ubuntu 20.04.md
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
imsmith / create-cloud-template.sh
Created April 6, 2021 20:27 — forked from chriswayg/create-cloud-template.sh
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
#!/bin/bash
set -o errexit
clear
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### HOW TO USE
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active March 28, 2024 11:50
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
mjhirst / cloudflare_ddns.sh
Last active June 8, 2023 21:57
Use Cloudflare's API to set Dynamic DNS records with Crontab
#!/bin/sh
# 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
CF_EMAIL='your@email.address'
CF_DNS='address.domain.com'
GET_IP=$(dig +short txt ch whoami.cloudflare @1.0.0.1)
@smijar
smijar / k3d-create-cluster-no-traefik.sh
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
johnhpatton / ephemeral-port-details.sh
Created January 29, 2020 15:18
Get TCP ephemeral port details to validate ephemeral port exhaustion.
#!/bin/bash
#
# REQUIRES
# - 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
sdmoko / OpenStack-instances-monitoring-with-Prometheus-Grafana.md
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 https://github.com/prometheus/prometheus/releases/download/v2.13.1/prometheus-2.13.1.linux-amd64.tar.gz

Extract Prometheus Server

@chriswayg
chriswayg / Ubuntu_Debian_Cloud_images_in_Proxmox.md
Last active March 28, 2024 01:13
Ubuntu and Debian Cloud images in Proxmox
@phiberoptick
phiberoptick / pritunl-server-custom-ssl_manually
Last active January 22, 2024 18:18
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
@marcostolosa
marcostolosa / CloudFlare-API.md
Last active February 22, 2024 20:22
Cloudflare API - Using Cloudflare’s API, you can do just about anything you can do on cloudflare.com via the customer dashboard.

Cloudflare's API Cheat-Sheet

VARIABLE VALUE
EMAIL The email address associated with your Cloudflare account.
KEY The global API key associated with your Cloudflare account.
DOMAIN The name of the domain to create a zone record for.
JUMP_START If true, automatically attempts to fetch existing DNS records when creating a domain’s zone record
ZONE_ID The unique ID of the domain’s zone record. Assigned by Cloudflare. Required when managing an existing zone record and its DNS records.