contents
- auto
compile-commands.jsondevshell - live reload a website generator which only supports auto rebuild
auto set up compile-commands.json for clangd in your devshell
let
src = /* ... */;
buildInputs = /* ... */;| // serve a page bundled with deno (with an HTML entrypoint) | |
| // - all in-memory | |
| // - re-builds automatically on refresh | |
| // - rudimentary auto-reload (not hot reloading, it just refreshes the page) | |
| import { extname } from "@std/path"; | |
| import { typeByExtension } from "@std/media-types"; | |
| import { debounce } from "@std/async"; | |
| import { DOMParser } from "@b-fuze/deno-dom"; | |
| import { serveDir } from "@std/http/file-server"; |
| """ | |
| extract a zip file which was mistakenly written with windows-style backslash-delimited paths | |
| (i.e. one which looks sort of like the example below) | |
| NOTE THAT THIS LIKELY DOES NOT CORRECTLY HANDLE ALL (or even most) EDGE CASES INVOLVING | |
| STUFF LIKE PATH TRAVERSAL, I WROTE THIS IN 5 MINUTES FOR A ONE-TIME USE CASE AND IT | |
| PROBABLY ISN'T SAFE TO RUN ON UNTRUSTED INPUT OR ANY ARCHIVES WITH WEIRD PATH NAMES | |
| $> unzip -l ../paint.net.5.1.12.portable.x64.zip | |
| # (most items omitted for space, but you get the point) |
contents
compile-commands.json devshellauto set up compile-commands.json for clangd in your devshell
let
src = /* ... */;
buildInputs = /* ... */;get just ip, with ip's json output and jq
ip -4 -json addr | jq --raw-output '.[] | select(.flags | contains(["LOOPBACK"]) | not) | .addr_info | .[0].local'ip docs so there could be some glaring edge cases i'm not handling here-4 for -6
ip -6 -json addrspecific pages from various places which i've found particularly useful. mostly programming language/library docs.
(this is just a summary, click through to see the full document)
sections at a glance: general resources. programming languages (rust, typescript, bash, reStructuredText).
| // a WIP collection of general-purpose JS helper things i've written | |
| // figured it made sense to start collecting these things in one place | |
| // rather than them being lost to time forever in old scripts | |
| const util = (() => { | |
| const idProxy = new Proxy({}, { | |
| get(target, prop, receiver) { return document.getElementById(prop); }, | |
| }); | |
| return { idProxy }; | |
| })(); |
| import bs4 | |
| import itertools | |
| import re | |
| import json | |
| import argparse | |
| import typing | |
| import csv | |
| def cli(): | |
| parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, epilog=r"""examples: |
| #!/usr/bin/env nix-shell | |
| #!nix-shell -p powershell -i pwsh | |
| <# | |
| .SYNOPSIS | |
| merge multiple individual git repos into a single git repo with subfolders, | |
| preserving the history from each. | |
| .PARAMETER MergeWhat | |
| what to merge from each existing repo (e.g. main, HEAD) | |
| .PARAMETER MainBranch |
| # searches for commits changing version line (looks like "@version 0.1.2") and tags them with their corresponding version number | |
| git log '--format=%H' | %{ $commit = $_; (git show --format=%b $commit | sls '^\+@version\s+([0-9.]+)').matches.groups | where Name -eq 1 | %{ $v=$_.value; git tag -a "v$v" $commit -m "v$v" } }; |