Skip to content

Instantly share code, notes, and snippets.

View bdsqqq's full-sized avatar
🎨

Igor Bedesqui bdsqqq

🎨
View GitHub Profile
@colelawrence
colelawrence / DURABLE_SESSIONS_AND_RECONSTRUCTION_IN_PI.md
Created April 24, 2026 16:30
Durable sessions and reconstruction in Pi

Durable Sessions and Reconstruction in Pi

This note explains how to think about durable state in Pi when the user navigates the session tree with /tree, starts a new session, resumes another session, or forks.

The short version:

  • Pi sessions are an append-only tree of entries with a movable leaf pointer.
  • /tree does not restart the extension runtime. It changes the active leaf and rebuilds the active conversation context.
  • If your extension keeps in-memory state, you are responsible for reconstructing it from durable session entries.
  • The central design decision is whether your state should be:
@Mihir2423
Mihir2423 / settings.json
Last active March 22, 2026 17:42
Zed Like Vs Code Config
{
"workbench.iconTheme": "ayu-mirage-zed",
"workbench.productIconTheme": "icons-carbon",
"editor.cursorStyle": "line",
"editor.cursorBlinking": "smooth",
"editor.cursorSmoothCaretAnimation": "on",
// --- Typography ---
"editor.fontSize": 14,
"editor.fontFamily": "'JetBrains Mono NL','JetBrains Mono', 'Zed Mono', monospace",
@palmamartin
palmamartin / vesper-dark-color.json
Last active February 1, 2024 11:00
Vesper theme for Zed
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Vesper",
"author": "Rauno Freiberg",
"themes": [
{
"name": "Vesper",
"appearance": "dark",
"style": {
"border": null,
@appsforartists
appsforartists / Linux for the Lenovo Legion Go.md
Last active October 2, 2025 19:37
Linux for the Lenovo Legion Go

I've been experimenting with running Linux (specifically NixOS) on the Legion Go. I intend to publish my configuration when it's in a good spot, but also thought it would be handy to have a shared space to document what we all learn in the mean time.

I'm admittedly new to both Linux and Nix, and appreciate any advice others can share too.

What's working

  • Touchscreen
  • Basic gamepad when both controllers are attached/detached
  • Rumble
  • Legion L+X to change perf modes
  • Sound + volume control
type Props<TagName extends keyof JSX.IntrinsicElements | void = void> = {
as?: TagName;
children?: React.ReactNode;
attributes?: Attributes<TagName>;
};
export type Attributes<TagName = void, O = void> = Omit<
(TagName extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[TagName]
export const chaosTestStrings = (): void => {
const textNodes = getAllTextNodes(document.body);
for (const node of textNodes) {
const textNodeLength = node.textContent ? node.textContent.length : 0;
if (node.textContent === null) {
return;
}
if (node.parentElement instanceof Element) {
if (node.parentElement.dataset.originalText === undefined) {
@solarkraft
solarkraft / syncthing-automerge.py
Last active December 27, 2025 02:28
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
# This script automatically handles Syncthing conflicts on text files by applying a
# git three-way merge between the previously synced version and each divergent version.
# It depends on the watchdog package and git.
# For automatic dependency installation when running with ´uv run --script deconflicter.py´:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "watchdog",
@alii
alii / use-throttle.ts
Created July 7, 2021 00:14
use-throttle.ts
export function useThrottle<T>(value: T, limit = 1000) {
const [throttledValue, setThrottledValue] = useState(value);
const lastRan = useRef(Date.now());
useEffect(() => {
const handler = setTimeout(() => {
if (Date.now() - lastRan.current >= limit) {
setThrottledValue(value);
lastRan.current = Date.now();
}
@whoisryosuke
whoisryosuke / dynamic-refs.jsx
Created May 3, 2021 21:07
ReactJS - Dynamically create Refs for children using useRef hook and createRef - @see: https://stackoverflow.com/questions/55995760/how-to-add-refs-dynamically-with-react-hooks
const {
useState,
useRef,
createRef,
useEffect
} = React;
const data = [
{
text: "test1"
@itsMapleLeaf
itsMapleLeaf / validation.ts
Last active July 6, 2022 20:05
validation take 2
type ValidatorResult<T> = { type: "valid" } | { type: "invalid"; error: string }
type ValidateFn<T> = (value: unknown) => ValidatorResult<T>
type Validator<T = unknown> = {
validate: ValidateFn<T>
parse: (value: unknown) => T
is: (value: unknown) => value is T
}