Skip to content

Instantly share code, notes, and snippets.

View kennycyb's full-sized avatar

Kenny Chong kennycyb

  • Malaysia
View GitHub Profile
@kennycyb
kennycyb / shell-random.md
Last active September 26, 2019 08:47
Shell: random string

Generate a random string using shell command:

head /dev/urandom | LC_ALL=C tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c128

CURL

Run a curl command in kubernetes

kubectl run curl-x --image=radial/busyboxplus:curl -i --tty --rm

REDIS

@kennycyb
kennycyb / aws-s3-bucket-list.sh
Created October 31, 2023 14:12
AWS | S3 | Bucket List
```
#!/bin/bash
# List all S3 buckets
buckets=$(aws s3 ls | awk '{print $3}')
# Print the list of buckets and their region
echo "List of S3 buckets and their regions:"
for bucket in $buckets
do
@kennycyb
kennycyb / aws-s3-objects-size.sh
Created October 31, 2023 14:18
AWS | S3 | Calculate Objects Size
```
#!/bin/bash
# Define the name of the CSV file
file="bucket_list.csv"
# Read the CSV file and calculate the size of each bucket
while IFS=',' read -r name region
do
echo "Calculating size of bucket: $name in region $region"
@kennycyb
kennycyb / .vimrc
Created November 7, 2023 14:47
.vimrc
set number
set incsearch
set mouse=a
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set smartindent
set nocompatible
syntax on
# decrypt gpg and untar to the basename
tgx() {
if [[ $# -ne 1 ]]; then
echo "Usage: tgx <file.tar.gz.gpg>"
return 1
fi
local input_file="$1"
local base_name="${input_file%.tar.gz.gpg}"
local output_dir="${base_name}"
@kennycyb
kennycyb / vmware-debian-share-folder.md
Created June 3, 2025 05:22
VMWare Fusion: Share Folder in Debian

VMware Fusion Shared Folders on Debian Guest

This guide provides step-by-step instructions for setting up and persistently mounting VMware Fusion shared folders on a Debian virtual machine using open-vm-tools.


🧰 Prerequisites

  • VMware Fusion installed on your macOS host.
  • A Debian guest OS installed in VMware Fusion.
@kennycyb
kennycyb / sshex.md
Last active June 9, 2025 05:48
SSH to VM with Path Synchronization

sshex: SSH to VM with Path Synchronization

A simple Bash/Zsh function to SSH into a remote machine and automatically cd into a directory that mirrors your current local path, relative to your home directory.

Usage

  1. Save the function: Add this entire block to your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.bash_profile).

  2. Source your config: After saving, apply the changes by running source ~/.bashrc (or your respective file), or simply open a new terminal session.