Skip to content

Instantly share code, notes, and snippets.

View quangnhut123's full-sized avatar

Tran Quang Nhut (Jonny) quangnhut123

View GitHub Profile
@quangnhut123
quangnhut123 / openvpn.service
Created October 3, 2017 08:17
Docker + OpenVPN systemd service
#
# Docker + OpenVPN systemd service
#
# Author: Kyle Manna <[email protected]>
# Source: https://github.com/kylemanna/docker-openvpn
#
# This service aims to make the update and invocation of the docker-openvpn
# container seemless. It automatically downloads the latest docker-openvpn
# image and instantiates a Docker container with that image. At shutdown it
# cleans-up the old container.
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: tiller
@quangnhut123
quangnhut123 / get_kubeconfig_custom_cluster_rancher2.sh
Created August 23, 2018 11:00 — forked from superseb/get_kubeconfig_custom_cluster_rancher2.sh
Get kubeconfig for custom cluster in Rancher 2.0
#!/bin/bash
# Usage: ./get_kubeconfig_custom_cluster_rancher2.sh cluster_name
# Needs to be run on the server running `rancher/rancher` container
# Check if jq exists
command -v jq >/dev/null 2>&1 || { echo "jq is not installed. Exiting." >&2; exit 1; }
# Check if clustername is given
if [ -z "$1" ]; then
echo "Usage: $0 [clustername]"
#!/bin/bash
# Docker CE Install
sudo yum update -y
sudo yum install -y jq
sudo amazon-linux-extras install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# Make docker auto-start
#!/bin/bash
while getopts c:s: flag
do
case "${flag}" in
c) cluster_name=${OPTARG};;
s) service_name=${OPTARG};;
esac
done
@quangnhut123
quangnhut123 / base_color.user.js
Last active September 30, 2024 02:12
Base Checkin Advanced Color
// ==UserScript==
// @name Base Checkin Color
// @namespace base
// @version 0.9
// @description Color base on checkin time
// @author Anonymous
// @match https://checkin.base.vn/me*
// @icon https://static-gcdn.basecdn.net/checkin/image/fav.png
// @grant none
// ==/UserScript==
kubecontext=$(kubectl config view -o jsonpath='{.contexts[*].name}')
oldIFS=$IFS
IFS=$' '
choices=( $kubecontext )
IFS=$oldIFS
PS3="Please select your kube context: "
select answer in "${choices[@]}"; do
for item in "${choices[@]}"; do
if [[ $item == $answer ]]; then
break 2
@quangnhut123
quangnhut123 / check_ecr_cost.sh
Last active May 24, 2023 03:30
Check ECR Cost and Usage
#!/bin/bash
export AWS_REGION=ap-northeast-1
process_profile() {
local profile=$1
echo -e "\n\n========== Processing profile: $profile =========="
export AWS_PROFILE=$profile
# Get the ECR cost and usage for the current month
local start_date=$(date -v1d +%Y-%m-%d)
@quangnhut123
quangnhut123 / disable_rds_auto_minor_version_upgrade.sh
Last active May 29, 2023 04:49
Disable RDS Auto Minor Version Upgrade
#!/bin/bash
export AWS_REGION=ap-northeast-1
check_profile() {
local profile=$1
local specific_text=$2
# Check if the profile contains the specific text
if [[ $profile == *"$specific_text"* ]]; then
return 0 # The string is found
else
@quangnhut123
quangnhut123 / charles-keygen.py
Last active September 8, 2023 15:57
Charles KeyGen
import random
import struct
class SimpleRC5:
P32 = 0xB7E15163
Q32 = 0x9E3779B9
R = 12
def __init__(self, key=None):