Skip to content

Instantly share code, notes, and snippets.

View repodevs's full-sized avatar

Edi Santoso repodevs

View GitHub Profile
@repodevs
repodevs / postgresql_cpu_spikes_note.md
Created July 21, 2026 07:24
Odoo PostgreSQL CPU Spikes on account_move_line Deletions

Troubleshooting Guide: PostgreSQL CPU Spikes on account_move_line Deletions

This note explains why deleting from account_move_line spikes CPU and provides step-by-step instructions to fix it natively in PostgreSQL.


🛑 The Problem

When executing DELETE FROM account_move_line WHERE id IN ( ? ), PostgreSQL triggers internal system checks (RI_FKey_check_relation) for every table referencing account_move_line. If those referencing columns are not indexed, PostgreSQL performs a Sequential Full Table Scan across dozens of tables for every single ID deleted, melting your CPU.


🛠️ Step-by-Step Resolution

@repodevs
repodevs / odoo_stock_move_download.py
Created January 13, 2026 10:05
Download Odoo Stock Move using API/RPC and save it to excel using pandas with flatten fields
import time
import odoorpc
import pandas
def odoo_download_stock_move_to_excel():
"""
Download stock move data from Odoo and save it to an Excel file.
"""
# Odoo connection
@repodevs
repodevs / .envrc
Created December 6, 2025 10:01
direnv auto load and set golang version
export GOROOT="$(go1.17 env GOROOT)"
PATH_add "$(go1.17 env GOROOT)/bin"
export GO111MODULE=on
export GOFLAGS=-mod=vendor
export CGO_ENABLED=0
@repodevs
repodevs / watch_command_postgres.sh
Created December 6, 2025 09:44
watch command to run postgres query every 1 seconds via psql
# get count postgres idle connection for database
$ watch -n 1 psql -U myuser -d mydb -c \"select count\(\*\) from pg_stat_activity where state in \(\'idle\', \'idle in transaction\'\) and datname = \'mydb\'\"
@repodevs
repodevs / metabase_query.sql
Created November 16, 2025 09:28
Metabase filter string as array using delimiter
SELECT
id, name
FROM table_users
WHERE 1=1
[[ AND name = ANY(STRING_TO_ARRAY({{ user_name }}, ',')) ]]
-- `user_name` is metabase variables, type: Text
-- `','` is the delimeter
-- usage: in variablse `user_name` -> `Sky,Blue,Green`
-- it's will equal to `AND name IN ('Sky', 'Blue', 'Greem')
@repodevs
repodevs / docker.sh
Created July 29, 2025 03:20
Docker filter name and remove
#!/bin/bash
# filter by name
docker ps -a -f name=^/sentry
# filter by name only container id
docker ps -a -q -f name=^/sentry
# filter by name then remove
docker rm $(docker ps -a -q -f name=^/sentry)
@repodevs
repodevs / README.md
Created July 27, 2025 03:54
Kiro System Prompt
@repodevs
repodevs / kiro.dev
Created July 25, 2025 18:50
Amazon Kiro.dev download url for macos
https://prod.download.desktop.kiro.dev/stable/metadata-dmg-darwin-arm64-stable.json
@repodevs
repodevs / README.md
Created January 13, 2025 09:04
Compress Video Size using ffmpeg

Usage

Download file video_compressor.sh

Make it Executeable by chmod +x video_compressor.sh

Run the script ./video_compressor.sh source_video 15

  • 15 is target new size in MB
@repodevs
repodevs / README.md
Created December 14, 2024 19:28
Bash script for upgrade odoo addons

Usage of upgrade_addons.sh script

  • Download it
  • Make it Executeable with chmod +x upgrade_addons.sh
  • Use it
./upgrade_addons.sh DATABASE ADDONS_A_TO_UGRADE,ADDONS_B_TO_UPGRADE