Skip to content

Instantly share code, notes, and snippets.

View VMuliadi's full-sized avatar

Vinsen Muliadi VMuliadi

View GitHub Profile
@VMuliadi
VMuliadi / decrypt-credentials-file-jenkins.groovy
Created February 7, 2024 09:35
decrypt credentials files in jenkins
import com.cloudbees.plugins.credentials.*;
import com.cloudbees.plugins.credentials.domains.Domain;
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl;
def jenkins_credentials_id = "my-jenkins-credentials-file-id"
SystemCredentialsProvider.getInstance().getCredentials().stream().
filter { cred -> cred instanceof FileCredentialsImpl }.
map { fileCred -> (FileCredentialsImpl) fileCred }.
filter { fileCred -> jenkins_credentials_id.equals( fileCred.id ) }.
forEach { fileCred ->
@VMuliadi
VMuliadi / starship.toml
Created August 4, 2023 09:33
my personal preference to keep my terminal console minimalist and clean
"$schema" = 'https://starship.rs/config-schema.json'
add_newline = true
format = '''
[┌───────────────────>](white)
[│](white)  $directory $git_branch$git_commit $terraform
[│](white) ? $localip on $hostname
[│](white)  $gcloud
[│](white) ? $kubernetes
[└─>](white) \$ '''
#!/bin/bash
droplet_name=""
droplet_ipv4=""
doctl_bin=$(which doctl)
function usage() {
printf """digitalocean doctl wrapper
manage digitalocean droplet management
./doctl-wrapper.sh -a action [-c context_name] [-d droplet_id]
@VMuliadi
VMuliadi / nginx-prometheus.conf
Last active February 28, 2023 10:17
oauth2-proxy and nginx configuration sample
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name _;
@VMuliadi
VMuliadi / nginx.conf
Last active July 9, 2023 06:02 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver
labels:
app: echoserver
spec:
replicas: 1
selector:
matchLabels:
@VMuliadi
VMuliadi / README.md
Last active July 13, 2022 16:28
python script to generate haproxy for your ngrok application

NGROK HAProxy Generator

NGROK HAProxy Generator is a tool to generate HAProxy config follows your ngrok tunnel address. I created this script to allow my devices connected to the services that deployed in my device. Since I didn't have a PRO account, I need to create a workaround to make the tunnel easy to remember.

Pre-requisites

  • python3.9
  • haproxy

How to Use

@VMuliadi
VMuliadi / twemproxy_exporter.json
Created January 7, 2022 02:25
twemproxy exporter dashboard for grafana
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
# bulk delete pod inside a kubernetes nodes
IFS=$'\n'
for i in $(kubectl describe nodes {{ nodes_name }} | grep -E -- '-fe|-be'); do
ns=$(echo $i | awk '{print $1}')
pod=$(echo $i | awk '{print $2}')
kubectl delete pod -n ${ns} ${pod}
done
# get all pod ips in the cluster and sorted it by ip
# 1st get all pod printed in wide output
@VMuliadi
VMuliadi / cloudflared-dnsmasq-install.sh
Created January 13, 2021 13:19
one-click script to modify dnsmasq to use cloudflared-proxy-dns
# download cloudflared
wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
tar -xvf cloudflared-stable-linux-arm.tgz
sudo mv cloudflared /usr/local/bin/cloudflared
# install cloudflared-proxy-dns systemd service
sudo tee /etc/systemd/system/cloudflared-proxy-dns.service >/dev/null <<EOF
[Unit]
Description=DNS over HTTPS (DoH) proxy client
Wants=network-online.target nss-lookup.target