Skip to content

Instantly share code, notes, and snippets.

View davlgd's full-sized avatar

David Legrand davlgd

View GitHub Profile
@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
Created March 30, 2025 17:00
Cargo/Rust clean
#! /bin/bash
pushd ~
find Documents -type f -name Cargo.toml -exec cargo clean --manifest-path {} \; 2>&1 | grep Removed
popd
@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
@davlgd
davlgd / indexnow.sh
Created May 11, 2024 16:00
IndexNow script to send batch of URL
#!/bin/bash
key="${INDEXNOW_KEY}"
domain=your.domain.com
url_array=()
url_list_json=$(printf ', "%s"' "${url_array[@]}")
url_list_json="[ ${url_list_json:2} ]"
@davlgd
davlgd / minimal-linux.sh
Last active May 1, 2024 12:23
Minimal Linux script
#!/bin/bash
# For this script you'll need gcc, gzip make, qemu, tar, wget
# Learn more on my blog: https://labs.davlgd.fr/posts/2024-05-whats-a-minimal-linux/
# Get and compile the kernel
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.8.tar.xz
tar xf linux-6.8.8.tar.xz
cd linux-6.8.8/
@davlgd
davlgd / index.js
Created March 7, 2024 22:07
Node.js 21.7.0 features demo
// This is a quick Node.js 21.7.0 new features demo
// Update Node.js to 21.7.0 to run this code
// You can use nvm or Volta to sideload it
// Run this file with: node index.js
const { styleText } = require('node:util');
const { parseEnv } = require('node:util');
const { loadEnvFile } = require('node:process');
const crypto = require('node:crypto');
const fs = require('node:fs');
@davlgd
davlgd / main.v
Created November 3, 2023 22:32
V recursive struct demo app
module main
struct Directory {
name string
subs []Directory
files []string
}
// Prints the directory structure recursively
fn print_directory(dir Directory, level int) {