Skip to content

Instantly share code, notes, and snippets.

View dheerapat's full-sized avatar

dheerapat dheerapat

  • Faculty of Pharmaceutical Science, Khon Kaen University
  • Khon Kaen, Thailand
View GitHub Profile
@dheerapat
dheerapat / lobster-race-condition.md
Created February 11, 2026 09:30
race condition fix

Ah, I see the issue! This is a race condition in your queue processing system. Let me explain what's happening:

The Problem

When you send two messages quickly:

  1. Message 1 ("weather") → enqueued
  2. Message 2 ("news") → enqueued
  3. Processing loop picks up Message 1 → calls agent.process(msg1)
  4. Before Message 1 finishes processing, the loop picks up Message 2 → calls agent.process(msg2)
@dheerapat
dheerapat / docker.yaml
Last active January 28, 2026 05:32
lakehouse-lakekeeper
services:
postgres-db:
image: postgres:latest
container_name: postgres-db
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: pass
POSTGRES_DB: postgres
TZ: UTC
ports:
enum WarehouseLocationERP {
Thaphra = 'WH02',
Thairath = 'WH03',
Province = 'WH90',
MachineInventory = 'WH25'
}
enum VirtualWarehouseERP {
ReadyToUseWarehouse = '02',
Machine = '03',
@dheerapat
dheerapat / re-test.py
Last active October 5, 2024 17:49
python regex example
import re
txt = """<|python_tag|><function=spotify_song_artist>{"n": "[\"BIRDS OF A FEATHER\", \"Espresso\", \"Please Please Please\", \"Not Like Us\", \"Gata Only\"]"}</function>"""
x = re.search("<function=(\w+)>(.*?)</function>", txt)
if x:
print("YES! We have a match!")
print(x.group())
else:
print("No match")
@dheerapat
dheerapat / .bashrc
Last active July 29, 2024 11:23
personal .bashrc alias and env
# shorten path at prompt to only 1 level above current file
export PROMPT_DIRTRIM=1
# start and stop docker-destop (in case clicking icon not working)
alias docker-desktop-start='systemctl --user start docker-desktop'
alias docker-desktop-stop='systemctl --user stop docker-desktop'