Skip to content

Instantly share code, notes, and snippets.

@masonjames
masonjames / unslopify.md
Last active April 23, 2026 22:15
unslopify workflwow for repoprompt
id DE38DEE7-10BB-43D4-B74F-CF47E30CE946
name Unslopify
icon wand.and.stars
tooltip Deep cleanup audit with safe implementation
description Audit and clean code slop across focused lanes: dead code, weak types, cycles, error hiding, legacy paths, bad comments, and obvious duplication.

Unslopify Mode

@lxe
lxe / bun-middleware.ts
Last active November 15, 2025 14:12
bun-middleware.ts
// TODO: somehow enforce ordering at compile time
type WriteOnly<T> = {
-readonly [K in keyof T]: T[K]; // TODO: Typescript can't block setters like this natively :)
};
type RouteHandler<T extends string> = ( // TODO: Extract from Bun... I think it has this built in
req: Bun.BunRequest<T>,
server: Bun.Server,
) => Response | Promise<Response>;
@ithilelda
ithilelda / PXE boot with GRUB2.md
Last active April 2, 2026 10:47
actually working pxe boot with grub2 on bios (client setup)

PXE Boot Setup with GRUB2 Tutorial

There are many tutorials on the internet that tell you how to setup a PXE Boot server with PXELINUX. There are however other options to replace PXELINUX like GRUB2 and iPXE. In this tutorial, I'm going to teach you how to setup a PXE Boot Environment with GRUB2, and later add menu entries to boot many popular OSes.

Notice: I'm not going to repeat the part where you setup the DHCP and TFTP server. Such section in other tutorials still applies to this scenario.

Making the GRUB2 image to be loaded by NIC

think the GRUB2 image as the same as PXELINUX's pxelinux.0 file. Your DHCP server must point to it, and it must be available on your TFTP server. Instead of shoving a blob down your throat and telling you that it just works, I'm going to walk you through the process of making one yourself by using an readily available linux installation.

zt_logo

Setting up ZeroTier as a default ethernet interface

Step 1: Install ZeroTier

Install ZeroTier on your gateway, join your network and authorize it, and then configure it as a basic IPv4 NAT router

/etc/sysctl.conf

@sheepla
sheepla / suggest.sh
Last active March 18, 2024 03:39
Web検索のサジェストキーワードを取得する.sh
#!/bin/sh
# suggest.sh -- get suggestion keywords from several site
#
# Usage:
# suggest SITE KEYWORDS...
# SITE:
# youtube(yt), archwiki(aw), duckduckgo(d), wikipedia(w), amazon(a)
# Example:
# suggest wikipedia Linux
@adamelliotfields
adamelliotfields / windows-ssh-no-password-with-keys-wsl2.md
Last active January 24, 2026 15:30
Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

I wanted to be able to SSH into my Windows laptop directly into Linux. I also wanted to disable password authentication and only allow public key (RSA in my case) authentication.

Scott Hanselman wrote a blog post on how to make your default WSL2 distro your default shell for SSH. Windows OS Hub published an article on using public key authentication. These were both helpful resources.

I'll assume you're already familiar with using SSH keys. If not, this article at DigitalOcean is very informative.

Add your public key to your authorized keys file

First thing you want to do is create the file $HOME\.ssh\authorized_keys. If you run into issues, it could be due to incorrect file ownership.

use bytes::{Buf, Bytes, BytesMut};
use opentelemetry::sdk;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::sdk::trace::{Builder, Sampler};
use opentelemetry::trace::TracerProvider;
use opentelemetry::{global::set_text_map_propagator, KeyValue};
use std::convert::TryFrom;
use std::env::var;
use std::net::SocketAddr;
use std::process::Stdio;
@ninlith
ninlith / build.txt
Last active February 12, 2025 04:55
Hybrid UEFI/BIOS multiboot USB drive
# Hybrid UEFI/BIOS multiboot USB drive
# Install required packages
sudo apt install gdisk grub2-common grub-efi-amd64-bin grub-pc-bin qemu-system
# Create an empty disk image
target_size=3.6G # $(lsblk -b --output SIZE -n -d /dev/sdX) for drive size
qemu-img create -f raw boottitikku.img "$target_size"
# Create a GUID Partition Table (GPT)
@plar
plar / ubuntu_disk_encryption.sh
Last active November 6, 2021 19:07
Ubuntu_Full_Disk_Encryption_Howto_2019 (shell commands)
sudo -i
export DEV="/dev/sda"
export DEV="/dev/nvme0n1"
export DM="${DEV##*/}"
export DEVP="${DEV}$( if [[ "$DEV" =~ "nvme" ]]; then echo "p"; fi )"
export DM="${DM}$( if [[ "$DM" =~ "nvme" ]]; then echo "p"; fi )"
# export SDD_PASS=secret123
sgdisk --print $DEV
sgdisk --zap-all $DEV
@FedericoPonzi
FedericoPonzi / CI.yml
Last active May 4, 2024 07:19
Ready to use Github workflow for cross-compiling a rust binary to many Linux architectures.
# Instruction + template repo: https://github.com/FedericoPonzi/rust-ci
# Search and replace <YOUR_BINARY_NAME> with your binary name.
name: CI
on:
pull_request:
push:
branches:
- master
tags: