Skip to content

Instantly share code, notes, and snippets.


James Sumners jsumners

View GitHub Profile
jsumners /
Created Nov 11, 2022 — forked from kmatt/
Install Void Linux on WSL2
# Based on
# prompt ">" indicates Powershell commands
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install
jsumners / index.mjs
Created May 5, 2022
Unsub GitHub org notifications
View index.mjs
import dotenv from "dotenv";
const ORG = process.env.ORG;
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
import { Client } from "undici";
const client = new Client("");
const headers = {
jsumners / walk.mjs
Created Nov 18, 2021
Walk a Node project's dependency tree and list the dependencies and their versions
View walk.mjs
import fs from 'fs/promises';
import treeify from 'treeify';
const result = await readModDir('.');
console.log(treeify.asTree(result, true));
async function readModDir(modDirPath) {
const dirEntries = await fs.readdir(new URL(modDirPath, import.meta.url));
const hasNodeModules = dirEntries.some(entry => entry === 'node_modules');
const pkgSrc = await fs.readFile(new URL(`${modDirPath}/package.json`, import.meta.url));
if [ ! -f package.json ]; then
# Default to npm regardless of missing package file.
echo "npm"
exit 0
NODE_VERSION=$(node --version)
jsumners /
Created Oct 24, 2021
Retrieve tabs from iOS Safari backup
  1. From a backup of the iOS device, extract /HomeDomain/Library/Safari/BrowserState.db to a local directory
  2. Place index.js and package.json in the same local directory
  3. npm install
  4. node index.js > lost_ios_safari_tabs.csv

Note: these instructions were created using an iMazing backup.

jsumners /
Last active Oct 11, 2021
Backup disk over ssh
  1. Boot host to be backed up with a rescue image, e.g. SystemRescueCD.
  2. Connect to destination host: ssh -L 8000:localhost:9000
  3. On destination host: socat -u TCP4-LISTEN:9000,reuseaddr,fork OPEN:/tmp/backup.img.bz2,create,append
  4. On host to be backed up: dd if=/dev/sda | pv | bzip2 -9 | nc localhost 8000


  1. socat installed on destination host
  2. /dev/sda is whatever disk is to be imaged and sent to remote host
jsumners /
Created Mar 3, 2021
Start new PR with an existing PR as a base

Ocassionally, someone will start a pull request and, for various reason, not see it through. Later, someone else may wish to finish that work. Even though the original author was unable to finish their work, we should still include their efforts in our project's history. To do so, the person wishing to finish the original pull request should start their new pull request using the original as the base.

The simplest workflow to accomplish this is:

$ # For the project on GitHub to your account and then:
$ git clone 
jsumners / no-wip.yml
Created Sep 23, 2020
No WIP PR merges
View no-wip.yml
name: "No WIP PR Title"
- opened
- edited
- synchronize
jsumners / bar.js
Created Apr 21, 2020
self-ref testing
View bar.js
// `lib/bar.js`
module.exports = 'bar'
jsumners / bar.js
Created Apr 21, 2020
self-ref testing
View bar.js
// `lib/bar.js`
module.exports = 'bar'