Skip to content

Instantly share code, notes, and snippets.

async function createCommitOnBranch(octokit, input) {
const result = await octokit.graphql('mutation($input:CreateCommitOnBranchInput!){createCommitOnBranch(input:$input){commit{oid}}}', {input})
return result.createCommitOnBranch.commit.oid
}
async function createCommitOnBranchInput(repo, target, commit, overrideParent = undefined) {
const sha = trimSuffix(await git(false, 'rev-parse', '--verify', commit), '\n') // will fail not a valid commit rev
const parents = overrideParent ?? trimSuffix(await git(false, 'rev-parse', sha + '^@'), '\n').split('\n')
const subject = trimSuffix(await git(false, 'show', '--no-patch', '--format=%s', sha), '\n')
const body = trimSuffix(await git(false, 'show', '--no-patch', '--format=%b', sha), '\n')
@pgaskin
pgaskin / nvmet-configfs.txt
Last active April 4, 2026 05:05
Documenting all nvmet configfs options (WIP).
// as of linux v7.0
discovery_nqn="nqn.2014-08.org.nvmexpress.discovery" // string < 256, must not have the same nqn as any subsystem
subsystem/nqn/
attr_allow_any_host=true // cannot set attr_allow_any_host=false if have allowed_host (EINVAL)
attr_version="1.3" // nvme version X.Y or X.Y.Z (EINVAL); cannot set once discovered (EINVAL); ignored and cannot set if passthru.enable (EINVAL); default 2.1.0
attr_serial="" // ascii (0x20 <= c <= 0x7e), len <= 20 (EINVAL); cannot set once discovered (EINVAL); default random
attr_model="" // ascii (0x20 <= c <= 0x7e), len <= 40 (EINVAL); cannot set once discovered (EINVAL); default "Linux"
attr_firmware="" // ascii (0x20 <= c <= 0x7e), len <= 8 (EINVAL); cannot set once discovered (EINVAL); default UTS_RELEASE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
body {
color-scheme: dark;
background: #000;
color: #fff;
android.util.Log.i("MaterialColors", String.format("system_accent1_0=#%08x", getResources().getColor(android.R.color.system_accent1_0, null)));
android.util.Log.i("MaterialColors", String.format("system_accent1_10=#%08x", getResources().getColor(android.R.color.system_accent1_10, null)));
android.util.Log.i("MaterialColors", String.format("system_accent1_50=#%08x", getResources().getColor(android.R.color.system_accent1_50, null)));
android.util.Log.i("MaterialColors", String.format("system_accent1_100=#%08x", getResources().getColor(android.R.color.system_accent1_100, null)));
android.util.Log.i("MaterialColors", String.format("system_accent1_200=#%08x", getResources().getColor(android.R.color.system_accent1_200, null)));
android.util.Log.i("MaterialColors", String.format("system_accent1_300=#%08x", getResources().getColor(android.R.color.system_accent1_300, null)));
android.util.Log.i("MaterialColors", String.format("system_accent1_400=#%08x", getResources().getColor(android.R.color.system_accent1_400, null)
// Command aftership-order-status extracts the full status information from an
// aftership order-status webpage.
package main
import (
"bytes"
"encoding/json"
"errors"
"math/bits"
"os"
@pgaskin
pgaskin / lzstring.go
Last active January 11, 2026 10:58
Simple lzstring decompression in Go.
package lzstring
import (
"errors"
"math/bits"
"unicode/utf8"
"unsafe"
)
// Decompress decompresses a lzstring-compressed byte sequence from a slice of
@pgaskin
pgaskin / lzstring-tiny.js
Last active January 11, 2026 07:08
Ultra-compact lzstring decompress implementation.
function decompress(buf) {
const fromCharCode = String.fromCharCode
const invalid = new Error("invalid")
let idx = 0, u16 = 0, bit = 0
const uint = bits => {
let res = 0
for (let i = 0; i < bits; i++) {
if (bit == 0) {
if (idx >= buf.length) {
@pgaskin
pgaskin / adb_418203510_workaround.go
Last active September 26, 2025 01:31
Workaround for chrome://inspect over ADB hanging. https://issuetracker.google.com/issues/418203510
package main
import (
"bytes"
"context"
"errors"
"flag"
"fmt"
"io"
"log/slog"
@pgaskin
pgaskin / zyte.go
Last active September 25, 2025 13:25
package zyte
import (
"bytes"
"cmp"
"context"
"encoding/json"
"fmt"
"io"
"maps"
package main
import (
"context"
"crypto/rand"
"crypto/rsa"
"encoding/binary"
"io"
"log/slog"
"net"