Skip to content

Instantly share code, notes, and snippets.

View kholisrag's full-sized avatar

Kholis Respati Agum Gumelar kholisrag

View GitHub Profile
@kholisrag
kholisrag / proxmox-ubuntu24lts-template.sh
Created August 9, 2025 21:14
Personal Proxmox VM Template Creation with Cloud Init
#!/bin/bash
qm create 9999 --name "ubuntu24lts-template" --memory 1024 --cores 1 --net0 virtio,bridge=vmbr1
qm importdisk 9999 /mnt/pve/local-sas/template/iso/noble-server-cloudimg-amd64.img local-zfs
qm set 9999 --ide2 local-zfs:cloudinit
qm set 9999 --scsihw virtio-scsi-pci --scsi0 local-zfs:vm-9999-disk-0
qm set 9999 --boot order=scsi0
qm set 9000 --serial0 socket
qm set 9999 --ipconfig0 ip=dhcp
qm set 9999 --ciuser ubuntu --cipassword 'XXXXX'
@kholisrag
kholisrag / n8n-combine-items-after-merge-append.js
Created July 15, 2025 06:45
n8n Code node - Javascript to combine multiple items to 1 items after merging using Append
// This script merges all incoming items into a single object.
const combinedObject = {};
// Loop through each item that flows into this node.
for (const item of items) {
// Merge the properties of the current item's JSON into our single object.
// Object.assign() copies all properties from the source (item.json)
// to the target (combinedObject).
// If a key already exists, it will be overwritten by the last one found.
@kholisrag
kholisrag / elasticsearch-indicies-reindex.sh
Created August 28, 2024 16:09
Elasticsearch Indicies Reindex Script
#!/bin/bash
# Elasticsearch credentials
ELASTIC_USER="elastic"
ELASTIC_PASSWORD="elasticpassword"
ELASTIC_URL="http://10.1.1.1:9200"
# File containing index names
INDEX_FILE="filtered-index.txt"
@kholisrag
kholisrag / update-disks-labels.sh
Last active August 26, 2024 10:38
bash script to update disk labels based on yaml input
#!/bin/bash
set -e
# YAML config file path
CONFIG_FILE="./x-disks-labels.yaml"
while read disk_name <&3
do
echo "Disk: $disk_name"
@kholisrag
kholisrag / grok-to-regex.py
Last active August 16, 2024 11:16 — forked from elementalvoid/grok-to-regex.py
Improved grok-to-regex.py to run with python 3.12 and nested grok pattern
#!/usr/bin/env python
import argparse
import re
from os import walk
from os.path import join
def get_patterns(patterns_dir):
patterns = {}
for (dirpath, _, filenames) in walk(patterns_dir):
for name in filenames:
@kholisrag
kholisrag / check.sh
Last active July 4, 2024 05:27
gcloud script to check Allow SSH from Internet (`default-allow-ssh`) in your organization / projects that you have permission to access
#!/bin/bash
projects=$(gcloud projects list --format="value(projectId)")
for project in $projects; do
echo "Checking project: $project"
if ! gcloud services list --project "$project" --enabled | grep -q compute.googleapis.com; then
echo "Compute Engine API not enabled for $project. Skipping..."
echo "--------------------"
@kholisrag
kholisrag / helmfile.yaml
Created July 2, 2024 09:49
script to integrate helm post-renderer using helmfile + kubectl apply -k / kustomize
---
helmfiles:
- "../controller/helmfile.yaml"
repositories:
- name: ghcr-actions
url: ghcr.io/actions/actions-runner-controller-charts
oci: true
releases:
@kholisrag
kholisrag / gh-rerun-pr-checks.sh
Last active July 2, 2024 04:43
Github CLI script to rerun checks for PRs used for loadtesting github arc runner scale set - autoscaler
#!/bin/bash
echo "Github CLI script to rerun checks for PRs"
# used for loadtesting github arc runner scale set - autoscaler
export GH_PAGER=""
export REPO_PREFIX="xxx-"
export LIMIT="10"
export PR_SEARCH_QUERY="is:pr is:open draft:false created:>=2024-06-01"
export REPO_SORT="updated" #best-match|forks|help-wanted-issues|stars|updated
@kholisrag
kholisrag / generate-ssh-config-gcp-vm.sh
Last active March 22, 2024 04:17
Generate SSH Config to make alias with gcp vm instances Internal IPs
#!/bin/bash
# Set the project ID
PROJECT_ID="XXXXXXXXX"
# Get instance information in JSON format
gcloud compute instances list \
--project "${PROJECT_ID}" \
--format="json" > ./instances.json
@kholisrag
kholisrag / check-cronjob.sh
Last active January 18, 2024 10:13
List All CronJob in an List of Instances defined in `instances.cfg` with gcloud compute network tags
#!/bin/bash
instance_list="instances.cfg"
date=$(date +'%FT%TZ')
mkdir -pv $(pwd)/cronjob-logs
mkdir -pv $(pwd)/cronjob-logs/$date
while read instance_name <&3
do
echo "----------------------------------------------" 2>&1 | tee -a $(pwd)/cronjob-logs/$date/$instance_name-cronjob.log