Skip to content

Instantly share code, notes, and snippets.

View davlgd's full-sized avatar

David Legrand davlgd

View GitHub Profile
@davlgd
davlgd / clean_claude
Created September 12, 2026 07:20
Claude Desktop clean
#! /bin/bash
#
# Reclaim disk from Claude Desktop's local VM bundle and Electron caches.
# Usage: clean_claude [images|all|cache] (default: images)
#
# images the default. Drops the decompressed VM artifacts -- rootfs.img,
# initrd, vmlinuz. Each sits next to the .zst it was expanded from,
# which we keep, so Claude rebuilds them locally: ~92% of the bundle
# back with nothing re-downloaded. A file is only taken if its .zst
# is really there, so a change in the bundle layout cannot turn this
@davlgd
davlgd / clean_node
Created September 12, 2026 07:14
Node/npm clean
#! /bin/bash
#
# Remove rebuildable node_modules under a root directory.
# Usage: clean_node [root] (default root: ~/Documents)
#
# Only deletes what an install can put back:
#
# inside a git repo gitignored -> yes. Tracked -> no: those are repository
# content, not build output (bun's test suite alone keeps
# ~34 node_modules fixtures under version control).
@davlgd
davlgd / pokeapi.js
Created March 19, 2026 11:46
Test Otoroshi JS
exports.on_backend_call = function(ctx) {
const name = (ctx.request.query.name && ctx.request.query.name[0])
? ctx.request.query.name[0].toLowerCase()
: 'pikachu';
let pokemon = null;
@davlgd
davlgd / cleanForked.sh
Last active January 4, 2026 11:49
Clean GitHub fork repositories one liner
gh repo list --fork --json nameWithOwner -L 100 -q '.[].nameWithOwner' | xargs -I {} gh repo delete {} --yes
@davlgd
davlgd / clever-install.ps1
Created April 26, 2025 10:22
Clever Tools Windows install script
# Clever Tools Installer for Windows
# This script downloads and installs Clever Tools in a configurable directory.
# Usage: .\clever-install.ps1 [install_dir]
param(
[string]$InstallDir = "$env:USERPROFILE\.clever"
)
Write-Host "Clever Tools Installer" -ForegroundColor Green
Write-Host "Target install directory: $InstallDir"
@davlgd
davlgd / clever-install.sh
Last active April 26, 2025 10:21
Clever Tools Linux & macOS install script
#!/usr/bin/env bash
# Clever Tools Installer for Linux & macOS
# This script downloads and installs Clever Tools in a configurable directory.
# Usage: ./clever-install.sh [install_dir]
set -e
# Colors for UX
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
@davlgd
davlgd / clean_cargo
Last active September 12, 2026 06:52
Cargo/Rust clean
#! /bin/bash
#
# Remove Rust build artifacts under a root directory.
# Usage: clean_cargo [-s|--stale] [root] (default root: ~/Documents)
#
# -s, --stale also offer to delete orphaned target/ dirs -- leftovers from a
# crate that has since been absorbed into a parent workspace, so
# cargo now builds it elsewhere and will never reclaim these.
stale=0
@davlgd
davlgd / list-alias
Created December 31, 2024 08:30
List aliases of your current shell
#!/usr/bin/env bash
#
# Configuration
#
# Colors
readonly CYAN='\033[36m'
readonly GREEN='\033[32m'
readonly GRAY='\033[90m'
@davlgd
davlgd / install_script.sh
Created October 5, 2024 22:14
New GNU/Linux system tools install script
#!/bin/bash
# Install Volta
curl https://get.volta.sh | bash
${HOME}/.volta/bin/volta setup
exec ${SHELL}
# Install Clever Tools and other package managers
npm i -g clever-tools bun pnpm yarn
@davlgd
davlgd / mkv.rb
Created June 11, 2024 04:34
Materia KV raw TCP Ruby demo
# frozen_string_literal: true
require 'socket'
def format_response(response)
response
.gsub(/^[+*:]/, '')
.gsub(/, \+/, ', ')
end