Skip to content

Instantly share code, notes, and snippets.

View hungnt1's full-sized avatar
๐Ÿ˜„

HungNT hungnt1

๐Ÿ˜„
  • Ha Tinh, Viet Nam
View GitHub Profile
@hungnt1
hungnt1 / create.sh
Created February 11, 2025 03:34 — forked from saumas/create.sh
Create an admin kubeconfig
#!/usr/bin/env bash
set -ex
NAMESPACE="default"
NAME="admin"
SECRET_NAME="admin-secret"
kubectl create serviceaccount -n $NAMESPACE $NAME
kubectl create clusterrolebinding $NAMESPACE-$NAME --clusterrole=cluster-admin --serviceaccount=$NAMESPACE:$NAME
@hungnt1
hungnt1 / docker-compose.yml
Created August 16, 2024 02:55 — forked from nimasrn/docker-compose.yml
redis replica with docker-compose
version: '3'
services:
redis:
image: redis:5.0.0
container_name: master
ports:
- "6379:6379"
networks:
- redis-replication
@hungnt1
hungnt1 / clean_jetson.sh
Created August 30, 2022 04:02 — forked from adujardin/clean_jetson.sh
Script to remove unnecessary stuffs from the Jetson to save disk space (WIP)
# https://elinux.org/Jetson/FAQ/BSP/RootFS_Reduction#Remove_installed_deb_packages
## Step 1, safe
sudo apt update
sudo apt autoremove -y
sudo apt clean
sudo apt remove thunderbird libreoffice-* -y
## Step 2, still safe but not recommended for dev use
# samples
@hungnt1
hungnt1 / ddos.conf
Created August 26, 2022 04:29 — forked from mattia-beta/ddos.conf
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###
@hungnt1
hungnt1 / 01_nginx-reload-post-hook.sh
Created February 19, 2022 02:21 — forked from justinhartman/01_nginx-reload-post-hook.sh
Let's Encrypt Certbot post hook command for Nginx which checks the updated configuration files and reloads the server if everything validates.
#!/usr/bin/env bash
#
# Certbot Nginx Reload
#
# Let's Encrypt Certbot post hook command for Nginx which checks the updated
# configuration files and reloads the server if everything validates.
#
# Author : Justin Hartman <code@justinhartman.co>
# Version : 1.0.1
# License : MIT <https://opensource.org/licenses/MIT>
@hungnt1
hungnt1 / iptables.sh
Created January 18, 2022 03:22 — forked from thomasfr/iptables.sh
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
@hungnt1
hungnt1 / Designing Event-Driven Systems links.md
Created November 29, 2021 08:03 — forked from giampaolotrapasso/Designing Event-Driven Systems links.md
List of links from Designing Event-Driven Systems by Ben Stopford
@hungnt1
hungnt1 / OpenStack-instances-monitoring-with-Prometheus-Grafana.md
Created September 20, 2021 03:48 — forked from sdmoko/OpenStack-instances-monitoring-with-Prometheus-Grafana.md
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

@hungnt1
hungnt1 / DisablingServicesOnServer2016wDE.ps1
Created May 24, 2021 10:05 — forked from xtratoast/DisablingServicesOnServer2016wDE.ps1
Disable unnecessary services that on Windows Server 2016 Desktop Experience (based on MS Security Blog recommendations)
# Disable extraneous services on Server 2016 Desktop Experience
# https://blogs.technet.microsoft.com/secguide/2017/05/29/guidance-on-disabling-system-services-on-windows-server-2016-with-desktop-experience/
Configuration DisablingServicesOnServer2016wDE
{
param(
[String]$ComputerName = "localhost",
[ValidateSet('ShouldBeDisabledOnly','ShouldBeDisabledAndDefaultOnly','OKToDisable','OKToDisablePrinter','OKToDisableDC')]
[String]$Level = 'OKToDisable'
)
@hungnt1
hungnt1 / nexmon.sh
Created July 27, 2020 07:38 — forked from someguycrafting/nexmon.sh
Raspberry PI 3 / Zero Wi-Fi monitor mode setup
#!/bin/bash
# Thanks to all the nice folks @seemoo-lab for making this possible.
# See: https://github.com/seemoo-lab/nexmon
# This script should be run as root (i.e: sudo ./nexmon.sh) from the /home/pi/ directory!
function info {
tput bold;
tput setaf 3;
echo $1;