Skip to content

Instantly share code, notes, and snippets.

View wasdee's full-sized avatar
🏠
Working from home

Nutchanon Ninyawee wasdee

🏠
Working from home
View GitHub Profile
@wasdee
wasdee / ipv6_finder.py
Created April 6, 2025 07:44
ipv6 tailscale
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = [
# "ipaddress",
# ]
# ///
"""
IPv6 Finder - A utility to find IPv6 addresses for Tailscale 4via6 subnet routers.
@wasdee
wasdee / db dump.sh
Created March 27, 2025 14:18
db dump
pg_dump -h dev_host -U dev_user -d dev_db -- no-owner -- no-privileges -f db_dev.sql
psql -h 127.0.0.1 -U local_user local_db -f db_dev.sql
@wasdee
wasdee / edit_with_cursor.ps1
Last active March 9, 2025 04:58
open cursor in windows
$cursorPath = "c:\Users\lifep\AppData\Local\Programs\cursor\resources\app\bin\cursor"
$arguments = "--wait", "--reuse-window"
if ($args.Count -gt 0) {
$arguments += $args
}
Start-Process -FilePath $cursorPath -ArgumentList $arguments -WindowStyle Hidden -Wait
@wasdee
wasdee / console.ipynb
Created February 6, 2025 16:23
jupyter sql init
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wasdee
wasdee / clone schema.sql
Last active February 6, 2025 15:45
pg clone schema
CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text)
RETURNS void AS $$
DECLARE
object text;
buffer text;
default_ text;
column_ text;
BEGIN
EXECUTE 'CREATE SCHEMA ' || dest_schema;
@wasdee
wasdee / ai_db_context
Last active December 6, 2024 09:05
Generate the DB schema for the AI Contexts
#!/usr/bin/env bash
# mise description="Generate the DB schema for the AI Contexts"
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
mkdir -p ./AIContexts/
docker run --rm -v "$PWD/AIContexts:/data" postgres:15 \
pg_dump $POSTGRES_URL -s -O -x -n public -t public.* -f /data/db_schema.sql
#!/usr/bin/env bash
# mise description="Generate the DB schema for the AI Contexts"
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
mkdir -p ./AIContexts/
docker run --rm -v "$PWD/AIContexts:/data" postgres:15 \
pg_dump $POSTGRES_URL -s -O -x -n public -t public.* -f /data/db_schema.sql
@wasdee
wasdee / update_postman.sh
Last active October 13, 2024 15:13
postman ubuntu 24 arm64 install script
#!/bin/bash
set -euo pipefail
# Directory setup
APP_DIR="${HOME}/Applications/Postman"
BIN_DIR="/usr/bin"
ICON_DIR="${HOME}/.local/share/icons"
DESKTOP_DIR="${HOME}/.local/share/applications"
@wasdee
wasdee / profile.sh
Created October 5, 2024 14:47
cursor remote-local binary to $EDITOR
if command -v cursor &> /dev/null; then
export EDITOR="$(command -v cursor) --wait"
export SUDO_EDITOR="$(command -v cursor) --wait"
fi
@wasdee
wasdee / bye_poetry.sh
Last active September 27, 2024 16:53
migrate from poetry to uv bash script
#!/bin/bash
# Not Tested, Generated by ChatGPT o1
# https://x.com/tiangolo/status/1839686032326836723
# Check if uv is in PATH
if ! command -v uv &> /dev/null
then
echo "Error: uv is not installed or not in your PATH."
echo "Please install uv before running this script."
exit 1