Skip to content

Instantly share code, notes, and snippets.

View thuanpham582002's full-sized avatar
๐Ÿ€
cosmic signal

thuanpham582002

๐Ÿ€
cosmic signal
View GitHub Profile
Pod errors due to โ€œtoo many open filesโ€
You may encounter that some pods fail to get running and the logs of these pods complain โ€œtoo many open filesโ€.
This may be caused by running out of inotify resources. Resource limits are defined by fs.inotify.max_user_watches and fs.inotify.max_user_instances system variables. For example, in Ubuntu these default to 8192 and 128 respectively, which is not enough to create multiple kind clusters with many pods.
To increase these limits temporarily run the following commands on the host:
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl fs.inotify.max_user_instances=512
To make the changes persistent, edit the file /etc/sysctl.conf and add these lines:
#!/bin/bash
# SoftEther VPN Server Auto Installation Script - NO SYSTEM UPGRADE
# Headless 100% - No Interaction Required - FASTER VERSION
set -e # Exit on any error
# Configuration variables
VPN_USER="vpn"
VPN_PASS="vpn"
-----BEGIN CERTIFICATE-----
MIID1TCCAr2gAwIBAgIULIdpnk5XdZ5HKgZKuHZklCBv0pEwDQYJKoZIhvcNAQEL
BQAwXjELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5
MRUwEwYDVQQKDAxPcmdhbml6YXRpb24xGTAXBgNVBAMMEGs4cy1vbWljeC12Mi52
aXAwHhcNMjUwMjIzMTQxMzUyWhcNMjYwMjIzMTQxMzUyWjBeMQswCQYDVQQGEwJV
UzEOMAwGA1UECAwFU3RhdGUxDTALBgNVBAcMBENpdHkxFTATBgNVBAoMDE9yZ2Fu
aXphdGlvbjEZMBcGA1UEAwwQazhzLW9taWN4LXYyLnZpcDCCASIwDQYJKoZIhvcN
AQEBBQADggEPADCCAQoCggEBAI38r5dwqDTAivbi8vNfIN01kyiXdB/sPlSnPRnN
GEOnW9b04jmxl0paiqFvJLYdnXMFBmg1aP+L2aR/PHHGxUSu5DRHkqrfzk/1HXiB
5n3avxEz/FgUCjnFomkDfof6P+dtozcLQQpniIguA+uhSs3oC11pBbOMnW9DfJfw
@thuanpham582002
thuanpham582002 / tpl_value.yaml
Created January 20, 2025 03:30
Auto convert tpl value to string. I called it is nested go template
{{ if regexMatch "^[0-9]+$" (tpl (printf "%v" $val) $) }}{{ tpl (printf "%v" $val) $ }}{{ else }}{{ tpl (printf "%v" $val) $ | quote }}{{ end }}
@thuanpham582002
thuanpham582002 / run.sh
Created December 12, 2024 04:26
Refresh Freetrial Cursor on Macos
# Clean cache
sudo rm -rf ~/Library/Application Support/Cursor
# Change mac id
#!/bin/bash
new_machine_id=$(uuidgen | tr '[:upper:]' '[:lower:]')
new_dev_device_id=$(uuidgen | tr '[:upper:]' '[:lower:]')
new_mac_machine_id=$(openssl rand -hex 32)
echo $new_machine_id > ~/Library/Application\ Support/Cursor/machineid
@thuanpham582002
thuanpham582002 / Dockerfile
Created December 9, 2024 10:41 — forked from hermanbanken/Dockerfile
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
#!/bin/bash
# This script merges multiple kubeconfig files into one while preserving existing configurations
set -e
# Step 1: Create backup directory if it doesn't exist
BACKUP_DIR="$HOME/.kube/backups"
mkdir -p "$BACKUP_DIR"
# Step 2: Create timestamped backup of current config
@thuanpham582002
thuanpham582002 / gen_cert.sh
Created September 17, 2024 04:26 — forked from adamrunner/gen_cert.sh
bash script to generate a self signed certificate for development use
#!/bin/bash
# Bash shell script for generating self-signed certs. Run this in a folder, as it
# generates a few files. Large portions of this script were taken from the
# following artcile:
#
# http://usrportage.de/archives/919-Batch-generating-SSL-certificates.html
#
# Additional alterations by: Brad Landers
# Date: 2012-01-27
@thuanpham582002
thuanpham582002 / .conf
Created July 8, 2024 23:04
Nginx File Hosting
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
#location / {
# root /usr/share/nginx/html;
# index index.html index.htm;
@thuanpham582002
thuanpham582002 / SDPFactory.kts
Last active November 29, 2024 02:28
SDP, SSP Gradle Script, Built on sdp of intuit
abstract class SDPFactory : DefaultTask() {
companion object {
private const val MIN_DPI = 300
private const val MAX_DPI = 1080
private const val DPI_STEP = 30
}
@Input
var positiveMax = 600