Skip to content

Instantly share code, notes, and snippets.

View Boshen's full-sized avatar
🦀
(╯°□°)╯︵ ┻━┻

Boshen Boshen

🦀
(╯°□°)╯︵ ┻━┻
View GitHub Profile
@Boshen
Boshen / machette.js
Last active April 17, 2024 05:50
npm machette - find unused dependencies by grepping the dependency name
// pnpm -r -c exec 'node /path/to/machette.js'
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const process = require('process');
const path = require('path');
async function main() {
const cwd = process.cwd();
@Boshen
Boshen / types_generated.rs
Last active August 3, 2022 12:35
jsparagus/crates/ast/src/types_generated.rs
// WARNING: This file is auto-generated.
use crate::source_location::SourceLocation;
use crate::arena;
use crate::source_atom_set::SourceAtomSetIndex;
use crate::source_slice_list::SourceSliceIndex;
#[derive(Debug, PartialEq)]
pub enum Void {
}
@Boshen
Boshen / prune.sh
Created January 12, 2021 03:50
prune node_modules
if [ -n "$1" ]; then WD="$PWD/$1"; else WD=$PWD; fi
run () {
(cd "$WD" && eval "$@") | sed 's/[[:space:]].//g'
}
stats() {
SIZE=$(run du -hs)
FILES=$(run find node_modules/ -type f \| wc -l)
echo "$1: $SIZE ($FILES files)"