Skip to content

Instantly share code, notes, and snippets.

View hoangddt's full-sized avatar

Hoang Truong hoangddt

View GitHub Profile
@hoangddt
hoangddt / app.py
Created May 25, 2025 18:54
streamlit drilldown screen
import streamlit as st
import pandas as pd
import psycopg2
# Database configuration (replace with your credentials)
DB_CONFIG = {
"host": "your-postgres-host",
"database": "your-database-name",
"user": "your-username",
"password": "your-password",
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.orm import sessionmaker
from video_processor.core.config import settings
from sqlalchemy import create_engine
async_engine = create_async_engine(
str(settings.ASYNC_SQLALCHEMY_DATABASE_URI),
echo=False,
future=True,
pool_size=32, # Set the number of connections in the pool
@hoangddt
hoangddt / JSR223 PostProcessor.groovy
Created May 7, 2025 10:55
Jmeter print request debug information
log.info("debug: ----begin-----");
log.info("debug: timeline_id value: " + vars.get("timeline_id"));
log.info("debug: counter value: " + vars.get("counter"));
// Print request method and URL
log.info("debug: Request Method: " + sampler.getMethod())
log.info("debug: Request URL: " + sampler.getUrl())
// Print request headers
def headers = sampler.getHeaderManager()
@hoangddt
hoangddt / worker.js
Created August 1, 2024 07:41 — forked from longseespace/worker.js
Cloudflare Worker Proxy
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const { pathname, search } = url;
var newPathname = pathname;
if (pathname.startsWith('/docs')) {
newPathname = pathname.replace('/docs', '');
@hoangddt
hoangddt / UND_ERR_INVALID_ARG.txt
Created January 31, 2024 05:42
UND_ERR_INVALID_ARG log
0|example.io | upstream image response failed for /img/assets/hero.png TypeError: fetch failed
0|example.io | at Object.fetch (node:internal/deps/undici/undici:11730:11)
0|example.io | at async invokeRequest (/var/www/example.io/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:16:12)
0|example.io | at async /var/www/example.io/node_modules/next/dist/server/next-server.js:362:35
0|example.io | at async imageOptimizer (/var/www/example.io/node_modules/next/dist/server/image-optimizer.js:537:13)
0|example.io | at async cacheEntry.imageResponseCache.get.incrementalCache (/var/www/example.io/node_modules/next/dist/server/next-server.js:517:61)
0|example.io | at async /var/www/example.io/node_modules/next/dist/server/response-cache/index.js:102:36 {
0|example.io | cause: InvalidArgumentError: invalid connection header
0|example.io | at processHeader (/var/www/example.io/node_modules/next/dist/compiled/undici/index.js:1:102994)
0|example.io | at new Reque
{
"meta": { "theme": "elegant" },
"basics": {
"name": "Truong Van Quoc Hoang",
"label": "Backend Department Manager",
"picture": "https://i.imgur.com/T2FZbqt.jpg",
"summary": "I am a Backend Department Manager who can build applications from the ground up. I have worked mostly at startup so I am used to wearing many hats. As a department manager, I focus on building the team and enable the developer to work efficient to deliver product with highest quality and on time. I'm generally very flexible when investigating new roles.",
"website": "https://hoangddt.net",
"email": "[email protected]",
"phone": "+84 34 865 8156",
@hoangddt
hoangddt / libreswan-client-install
Last active August 1, 2020 05:03
libreswan-client-install
#!/bin/bash
apt-get -yq install wget dnsutils openssl \
iptables iproute2 gawk grep sed net-tools || exiterr2
apt-get -yq install libnss3-dev libnspr4-dev pkg-config \
libpam0g-dev libcap-ng-dev libcap-ng-utils libselinux1-dev \
libcurl4-nss-dev flex bison gcc make libnss3-tools \
libevent-dev ppp xl2tpd || exiterr2
@hoangddt
hoangddt / docker-command.sh
Last active January 21, 2019 08:23
Docker compose keycloak, Postgres Database
#!/bin/bash
docker run --rm -p 8888:8080 -e POSTGRES_USER=keycloak -e POSTGRES_DATABASE=keycloak_db -e POSTGRES_PASSWORD=4vSm/fNxO6LHSymo3yVPgQ== -e POSTGRES_PORT_5432_TCP_ADDR=postgres.default -e POSTGRES_PORT_5432_TCP_PORT='5432' my-keycloak
docker run --name=postgres -p 5432:5432 -e POSTGRES_USER=keycloak -e POSTGRES_DB=keycloak_db -e POSTGRES_PASSWORD=local postgres
psql -h localhost -p 5432 -U keycloak keycloak_db
docker run -it --rm --link postgres:postgres postgres psql -h postgres -U keycloak keycloak_db
@hoangddt
hoangddt / explanation.md
Created December 20, 2018 10:50 — forked from masak/explanation.md
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <[email protected]>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@hoangddt
hoangddt / user_setting.md
Last active October 3, 2018 03:32
Code Editor setting
// VS COde
{
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Material Theme",
    "editor.fontFamily": "Inconsolata-g",
    // "editor.fontWeight": "100",
    "editor.fontSize": 11,
    "editor.letterSpacing": 0.3,
    "editor.minimap.showSlider": "always",