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
@gilangvperdana
gilangvperdana / README.md
Created May 31, 2023 14:38
Nginx Block Generator with Bash Script

General

If you need to automate a NGINX block template, you can use this script.

  • add-tcpudcp.sh -> Generate TCP/UDP Nginx block.
  • del-tcpudp.sh -> Delete TCP/UDP Nginx block.
  • add-dnsNginx.sh -> Add HTTPS Nginx block.
  • del-dnsNginx.sh -> Delete HTTPS Nginx block.

This script just Nginx block reverse proxy template, if you need an unique template of Nginx, you must customize that script.

@gilangvperdana
gilangvperdana / README.md
Last active July 20, 2023 15:05
Generate Wild Card TLS Certificate Cloudflare DNS Management

General

This tutorial tested on Ubuntu Server 20.04 with Cloudflare for DNS Management.

Prerequisites

  • Make sure you have generated API Token with specific zone and DNS read & write permission.

Create cloudflare.ini

nano /root/cf/cloudflare.ini
@gilangvperdana
gilangvperdana / ping.php
Last active May 27, 2023 12:04
Monitor an Endpoint on Telegram
<?php
// Config information
$server = "IP/DOMAINWHOTOMONITOR"; // the address to test, without the "http://"
$port = "PORT";
// Telegram Bot API configuration
$telegramToken = 'YOURTELEGRAMTOKEN';
$chatId = 'YOURTELEGRAMCHATID';
@gilangvperdana
gilangvperdana / dnscheck.sh
Created May 15, 2023 04:53
Notify New/Deleted DNS Record to Telegram on Cloudflare with Cloudflare API
#!/bin/bash
# Token bot Telegram dan chat ID penerima notifikasi
TOKEN="YOUR_BOT_TOKEN"
CHAT_ID="YOUR_TELEGRAM_CHAT_ID"
# Fungsi untuk mengirim notifikasi ke Telegram
function send_telegram_notification {
MESSAGE="$1"
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendMessage" \
@gilangvperdana
gilangvperdana / README.md
Last active May 11, 2023 17:34
Cloudflare API

General

If you need a shortcut or want to develop operational features on Cloudflare, you can take advantage of the Cloudflare API that I have tried (only core functions) with references like my notes.

DNS

CREATE A NEW RECORD

#!/bin/sh
   
EMAIL="yourCF@email.com"; \
KEY="YOURCDAPIKEY"; \
@gilangvperdana
gilangvperdana / awsCloudFormation-app.yaml
Last active April 9, 2023 03:44
Example of AWS CloudFormation
AWSTemplateFormatVersion: 2010-09-09
Description: >-
Application Template: Demonstrates how to reference resources from a different stack.
This template provisions an EC2 instance in a VPC Subnet provisioned in a different stack.
# This template creates:
# Amazon EC2 instance
# Security Group
######################
@gilangvperdana
gilangvperdana / README.md
Created April 7, 2023 03:43
Generate TLS Certificate on Ubuntu Server with OpenSSL

Create Openssl.cnf

nano openssl.cnf

---
[req]
default_bits       = 4096
distinguished_name = req_distinguished_name
req_extensions = req_ext
@gilangvperdana
gilangvperdana / README.md
Last active June 2, 2024 04:28
VSCode Server on Ubuntu Installation

VSCode Server Installation

curl -fsSL https://code-server.dev/install.sh | sh
PASSWORD=my-custom-password
code-server --auth password --bind-addr 0.0.0.0:8080

Change bind port, IP & Password

@gilangvperdana
gilangvperdana / registry-minio.md
Created March 26, 2023 14:05 — forked from leanderjanssen/registry-minio.md
Docker Registry with Minio storage example

Running a docker registry with Minio S3 backend

Run minio in a container

docker run -d -p 9000:9000 --name minio minio/minio server /export

Use docker logs to retrieve access key and secret key from minio container

docker logs minio

Create config.yml for Docker Registry

This file will have to be mounted to /etc/docker/registry/config.yml

@gilangvperdana
gilangvperdana / DecryptBase64.py
Last active March 27, 2023 16:34
How to decrypt Base64 to Plaintext & Viceversa
import base64
base64_message = 'BASE64' # pesan yang ingin di-decode
decoded_message = base64.b64decode(base64_message) # proses decoding
print(decoded_message.decode('utf-8')) # print hasil decoding