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
@amunchet
amunchet / noVNCCopyPasteProxmox.user.js
Last active October 30, 2024 17:14
Copy/Paste for noVNC Proxmox
// ==UserScript==
// @name noVNC Paste for Proxmox
// @namespace http://tampermonkey.net/
// @version 0.2a
// @description Pastes text into a noVNC window (for use with Proxmox specifically)
// @author Chester Enright
// @match https://*
// @include /^.*novnc.*/
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant none
@eXsoR65
eXsoR65 / proxmox_template.md
Last active September 1, 2024 09:22
Creating a Proxmox Template from a Generic Cloud image.
# Chanage directories to /tmp
cd /tmp
# Download the Generic Cloud image from the distro downloads
wget https://Link_to_Generic_Cloud_image.com
# Validate the file is a QEMU QCOW2 image.
file ./Generic_Cloud_Image.qcow2


# Set this to your Proxmox host name; it's case sensitive! Check with `pvesh ls /nodes`
@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
@GlitchWitch
GlitchWitch / _OpenVPN Server for LAN Access only.md
Last active September 19, 2024 08:15
OpenVPN Server for LAN Access only (no internet forwarding)

How to setup an OpenVPN server for LAN Access only

Install OpenVPN

wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh

Edit server.conf

/etc/openvpn/server/server.conf

Change the OpenVPN LAN address to prevent interfering with other OpenVPN connections

@taoyuan
taoyuan / generate_self_signed_certification.md
Last active November 5, 2024 17:35
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)
@SMAK1993
SMAK1993 / o7k-volume-and-instance-migration.sh
Last active November 3, 2024 09:50
Script for transferring VMs from one Openstack project to another
#!/bin/bash
# Requires Bash version 4+ because it uses dictionaries/arrays
# Define the 2 project IDs
# I assume the same user has access to both projects
OLD_PROJECT=INSERT_OLD_PROJECT_ID;
NEW_PROJECT=INSERT_NEW_PROJECT_ID;
# Maintain a dictionary of volume IDs to VM names so that we can attach to the correct VM later
# Detach the non-boot volumes from the VMs in the old project and transfer them to the new project
@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