Skip to content

Instantly share code, notes, and snippets.

View Astro36's full-sized avatar

Seungjae Park Astro36

View GitHub Profile
@Astro36
Astro36 / confirm-write.ts
Created July 23, 2026 00:40
Pi Agent - Confirm before write/edit
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import { resolve, dirname } from "node:path";
export default function (pi: ExtensionAPI) {
const approvedFiles = new Set<string>();
const approvedDirs = new Set<string>();
const isApproved = (filePath: string) => {
if (approvedFiles.has(filePath)) return true;
let dir = dirname(filePath);
@Astro36
Astro36 / status-cost.ts
Created July 23, 2026 00:27
Pi Agent Cost Tracker
/**
* Status Cost — daily cost tracking with auto-reset on reset day.
* Persisted to ~/.pi/cost.json
* Commands: /cost, /cost-reset
*/
import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
@Astro36
Astro36 / README.md
Created February 24, 2026 01:41
Raspberry PI Wi-Fi Config

1. Disable Wi-Fi Power Saving

1.1 Concept

NetworkManager may enable Wi-Fi power saving by default. To ensure stable networking, set wifi.powersave = 2 to disable power saving.

NetworkManager Power Save Values

| Value | Meaning |

@Astro36
Astro36 / compose.gpu.yml
Last active July 31, 2024 06:16
Windows ML Dev Env /w Docker
services:
psj:
image: nvcr.io/nvidia/pytorch:24.06-py3
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
driver: nvidia
shm_size: 10gb
@Astro36
Astro36 / .clang-format
Last active August 26, 2020 07:25
My C++ Clang-Format Style
# https://gist.github.com/Astro36/211443b279e964af9b2ed05ddec0b1ee
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
# AlignConsecutiveMacros: false
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: false
@Astro36
Astro36 / renew-certbot.sh
Created May 30, 2020 07:26
Renew Let's Encrypt Certificate
sudo nginx -s stop
sudo certbot renew
nginx
@Astro36
Astro36 / .vimrc
Last active May 1, 2020 13:38
My Vim Config
colorscheme delek
set nu
set mouse=a
set ruler
set shiftwidth=4
set tabstop=4
set softtabstop=4
#include <iostream>
template<unsigned int N>
constexpr unsigned int factorial_v = N * factorial_v<N - 1>;
template<>
constexpr unsigned int factorial_v<1> = 1;
template<unsigned int N, unsigned int K>
constexpr unsigned int binomial_v = factorial_v<N> / (factorial_v<K> * factorial_v<N - K>);
template<typename T, typename Index = std::size_t, typename = void>
struct has_subscript_operator : std::false_type {};
template<typename T, typename Index>
struct has_subscript_operator<T, Index, std::void_t<decltype(std::declval<T>()[std::declval<Index>()])>> : std::true_type {};
template<typename T, typename Index = int>
using has_subscript_operator_v = typename has_subscript_operator<T, Index>::value;
template<typename T>
@Astro36
Astro36 / iterable.h
Last active March 29, 2020 14:17
Check if arbitrary type can use for-each loop by using C++ SFINAE
#include <iterator>
#include <type_traits>
template<typename T, typename = void>
struct is_iterable : std::false_type {};
template<typename T>
struct is_iterable<T, std::void_t<decltype(*std::begin(std::declval<T&>()) != *std::end(std::declval<T&>())),
decltype(++std::declval<decltype(std::begin(std::declval<T&>()))&>())>> : std::true_type {};