Skip to content

Instantly share code, notes, and snippets.

@Raboo
Raboo / JVM.md
Last active August 6, 2025 16:11
JVM Container optimization notes

JVM 21 introduces G1GC Generational, it can reduce heap and cpu consumption.
ZGenerational ZGC mode organises objects into young and old generations, allowing tailored garbage collection strategies. Fast incremental sweeps in the young generation ensure responsive performance, while comprehensive, less frequent clean-ups in the old generation maintain stability over time, exclusively supported in recent JDK versions like JDK 21

-XX:+UseZGC -XX:+ZGenerational

ZGC got production ready in JDK 15, focuses more on lower latency, but can also increase throughput in many cases.

-XX:+UseZGC
@Raboo
Raboo / top-5-cpu-and-mem.md
Last active August 1, 2025 07:47
Top 5 CPU and Top 5 Memory users

List top 5 CPU users and list top 5 Memory users.

ps -eo user,pcpu,pmem | tail -n +2 | \
awk '{
  num[$1]++; cpu[$1] += $2; mem[$1] += $3
}
END {
  # Dump into files for sorting separately
  for (u in cpu)
@Raboo
Raboo / gist:d0a4d871eba5a3fe162ed32b5a4d6f8f
Last active April 5, 2025 10:52
render ansible jinja2 templates
ansible all -i localhost, -c local -m template -a "src=test.j2 dest=./test.txt" --extra-vars=@group_vars/all.yml
ansible all -i "localhost," -c local -m template -a "src=test.j2 dest=./test.txt" --extra-vars='{"users": ["Mike", "Smith", "Klara", "Alex"]}'
@Raboo
Raboo / considerations-for-running-postgres-on-nfs.md
Last active June 14, 2024 08:04 — forked from fardjad/considerations-for-running-postgres-on-nfs.md
[Considerations for Running Postgres on NFS] #postgres #nfs #fsync #fsexport #mount

Considerations for Running Postgres on NFS

Background

Over the weekend, I decided to try running a Postgres database in my Homelab. In my current setup, the most convenient option for storage is NFS. However, NFS is especially tricky for databases. A misconfigured setup can lead to performance or data corruption issues.

After watching

Computer Information:
Manufacturer: To Be Filled By O.E.M.
Model: To Be Filled By O.E.M.
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
CPU Family: 0x6
@Raboo
Raboo / migrate-dockerhub-to-ghcr.sh
Last active December 14, 2022 21:58 — forked from charlieoleary/migrate-to-ecr.sh
Migrate your Docker Hub organization(docker.io) to Github Container Registry(ghcr.io).
#!/bin/bash
#
# A simple bash script to migrate your Docker Hub organization to Github Container Registry.
# forked from https://gist.github.com/charlieoleary/05c1dab2e19703f73a041e585e060dc9
#
# In order for this to work you must run this from a system that is logged in to both the GHCR
# repository you are migrating to and the Docker Hub organization you are migrating FROM with
# podman.
#
# Due to how Docker works (pulling / pushing images), this script can be run over and over
@Raboo
Raboo / 1vcpu-2GBram-64GBnvme-vultr-se-sto.log
Created January 14, 2022 10:52
Vultr 10$ per month, 1vcpu, 2GB RAM, 64GB NVMe, DC Sweden Stockholm yabs.sh
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2021-12-28 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Fri 14 Jan 2022 10:33:16 AM UTC
Basic System Information:
---------------------------------
@Raboo
Raboo / force_uninstall_hive.sh
Last active December 17, 2021 11:57
Ambari force uninstall components without dependencies.
#!/bin/sh
# https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+components+on+a+host
AMBARI_USER='admin'
AMBARI_PASSWORD='PWPWPW'
AMBARI_HOST='ambari.local'
CLUSTER_NAME='hdp'
NODE='hadoop-master04.se-ix.delta.prod'
# curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By: ambari" -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/components/ | grep component_name
curl -u $AMBARI_USER:$AMBARI_PASSWORD -H "X-Requested-By:ambari" -i -X DELETE http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER_NAME/hosts/$NODE/host_components/WEBHCAT_SERVER
@Raboo
Raboo / kubeswitcher.1m.sh
Created June 11, 2021 11:03
xbar/bitbar Kubeconfig Namespace & Context Switcher
#!/bin/bash
# -*- coding: utf-8 -*-
# <xbar.title>Kubeconfig Namespace & Context Switcher</xbar.title>
# <xbar.version>v0.1</xbar.version>
# <xbar.author>Elias Abacioglu</xbar.author>
# <xbar.author.github>Raboo</xbar.author.github>
# <xbar.desc>Displays active kubeconfig namespace and allows you to easily change namespaces.</xbar.desc>
# <xbar.dependencies>bash,kubectl</xbar.dependencies>
@Raboo
Raboo / aptly_ubuntu.rb
Last active March 4, 2019 17:22
chef aptly cookbook mirroring ubuntu repos
# ubuntu
excluded_sections = '!Section (comm), !Section (debug), !Section (fonts), !Section (games), !Section (gnome), !Section (graphics), !Section (kde), !Section (localization), !Section (math), !Section (restricted/x11), !Section (science), !Section (sound), !Section (translations), !Section (universe/comm), !Section (universe/debug), !Section (universe/electronics), !Section (universe/embedded), !Section (universe/fonts), !Section (universe/games), !Section (universe/gnome), !Section (universe/gnustep), !Section (universe/graphics), !Section (universe/hamradio), !Section (universe/kde), !Section (universe/localization), !Section (universe/math), !Section (universe/news), !Section (universe/science), !Section (universe/sound), !Section (universe/translations), !Section (universe/video), !Section (universe/x11), !Section (universe/xfce), !Section (universe/zope), !Section (video), !Section (x11), !Section (zope)'
# packages that we want to include from excluded sections
included_packages = '| fonts-dejavu|