Skip to content

Instantly share code, notes, and snippets.

View pasdam's full-sized avatar
🚀
Working on cool things

pasdam

🚀
Working on cool things
View GitHub Profile
@pasdam
pasdam / bca_pdf_to_csv.py
Last active July 11, 2026 11:24
Python script to convert BCA e-Statement PDFs to CSV and extract all the data
#!/usr/bin/env python3
"""Convert a BCA (Bank Central Asia) e-Statement PDF to CSV.
Pure standard library (zlib + re + csv). BCA e-statements embed the whole
transaction table in a single FlateDecode content stream, drawn as positioned
text (Tm / Tj operators) with a monospace font at fixed column x-positions.
This script decompresses that stream, rebuilds rows by their y-coordinate and
columns by their x-coordinate, and writes a CSV in the exact layout the sibling
`bca.yaml` unifier config consumes:
@pasdam
pasdam / otel-collector-config.yaml
Created September 5, 2023 15:40
Opentelemetry collector config to send telemetry to clickhouse
connectors:
spanmetrics:
histogram:
explicit:
buckets: [100us, 1ms, 2ms, 6ms, 10ms, 100ms, 250ms]
dimensions:
- name: http.method
default: GET
- name: http.status_code
exemplars:
@pasdam
pasdam / dcu.sh
Last active September 18, 2023 13:32
docker compose up wrapper to automatically restart containers for which read-only volumes have been changed on the host machine
#!/bin/sh
print_usage() {
SCRIPT_NAME=$(basename "$0")
echo "Simple wrapper of docker compose to add labels to force the container re-creation when config files are updated"
echo "Example: $SCRIPT_NAME -f compose.custom.yaml up -d"
exit "$1"
}
FILES_ARG=
@pasdam
pasdam / main.go
Last active July 27, 2023 14:32
Go - Print html to pdf
package main
import (
"errors"
"log"
"os"
"github.com/playwright-community/playwright-go"
)
#!/bin/bash
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
print_usage() {
SCRIPT_NAME=$(basename "$0")
@pasdam
pasdam / cpr.sh
Last active March 4, 2024 10:26
Script to automatically create a PR to main
#!/bin/sh
set -e
REPO_DIR=$1
if [ -z "$REPO_DIR" ]; then
REPO_DIR="./"
fi
REPO_DIR=$(git rev-parse --show-toplevel)
if [ "$REPO_DIR" = ".git" ]; then
#!/usr/bin/env bash
DIR=$1
cd "$DIR"
for d in */ ; do
if [[ "$d" =~ .*\([0-9\-]+\).* ]]; then
date=$(echo $d | sed "s/.*(//" | sed "s/)\///")
new_name="$date - $(echo $d | sed "s/$date//" | sed "s/ ()//")"
if [ ! -d "$new_name" ]; then
mv "$d" "$new_name"
#!/bin/sh
DIR=$1
EXTENSIONS_LIST="(MOV|MP4|AVI)"
HANDBRAKE_CLI=HandBrakeCLI
find_files() {
find "$DIR" -type f 2> /dev/null | egrep -i "\.$EXTENSIONS_LIST" | egrep -i --invert-match ".*_s\.$EXTENSIONS_LIST" | egrep --invert-match "/\."
}
#!/bin/sh
DIR=$1
if [ -z "$DIR" ]; then
DIR=./
fi
if [ ! -d "$DIR" ]; then
1>&2 echo "Invalid dir: $DIR"
exit 1
fi
# source: https://alexwlchan.net/2019/05/finding-unused-variables-in-a-terraform-module/
# import os
# import sys
# import hcl
# def get_variables_in_file(path):
# try: