Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wraithgar's full-sized avatar

Gar wraithgar

  • GitHub Staff
  • Tri-Cities, WA
View GitHub Profile
@wraithgar
wraithgar / colors.js
Created April 5, 2024 17:22
3-4 bit and 256-color ansi output
console.log('3-4 bit:')
const lows = []
for (let c = 30;c<=37;c++) {
lows.push(`\x1b[${c}m${c}\x1b[0m`)
}
console.log(lows.join(' '))
console.log('256 color:')
let mediums = []
for (let c = 0;c<=231;c++) {
if (!(c % 16)) { // new row
#!/usr/bin/env node
const https = require('node:https')
const es = require('event-stream')
const JSONStream = require('JSONStream')
const main = async () => {
const r = []
for (let i = 0; i < 10; i++) {
r.push(new Promise((resolve, reject) => {
if (process.argv[2] === 'stream') {
const breads = [
['toast','pieces of toast'],
['muffin','muffins'],
['teacake','teacakes'],
['bun','buns'],
['bap','baps'],
['baguette','baguettes'],
['bagel','bagels'],
['croissant','croissants'],
['crumpet','crumpets'],
@wraithgar
wraithgar / nespad.a86
Created February 6, 2023 15:57
nes pad DOS driver
.radix 16
org 100
clockoff equ 000000xb
pad_init equ 001001xb
pad_clockon equ 010010xb
pad_power equ 100100xb
@wraithgar
wraithgar / example.txt
Created January 12, 2023 15:38
npm pick manifest example
> pick = require('npm-pick-manifest')
[Function (anonymous)]
> packument
{
name: 'some-package',
'dist-tags': { foo: '1.0.1' },
versions: {
'1.0.0': { version: '1.0.0' },
'1.0.1': { version: '1.0.1' },
'1.0.2': { version: '1.0.2' },
console.log(require('./package.json'))
@wraithgar
wraithgar / main.js
Last active July 21, 2022 17:55
npm exec gist
#!/usr/bin/env node
const pkg = require('./package.json')
console.log(`Hi there! I am ${pkg.name} version ${pkg.version}`)
@wraithgar
wraithgar / all-highest.js
Last active February 28, 2022 19:34
batch latest versions for a given npm package
'use strict'
const pacote = require('pacote')
const fetch = require('npm-registry-fetch')
const semver = require('semver')
const perRequest = 10
async function main() {
const manifest = await pacote.manifest(process.argv[2])
@wraithgar
wraithgar / npm-cli-autorelease-prs.graphql
Last active December 6, 2022 22:26
graphql dependabot open issues query
query {
search (query: "org:npm topic:npm-cli", type: REPOSITORY, first:100) {
nodes {
... on Repository {
nameWithOwner
pullRequests (labels: ["autorelease: pending"], first:100, states: [OPEN]) {
nodes {
number
url
title
@wraithgar
wraithgar / instructions.txt
Created December 16, 2021 18:17
github graphql contributions query
// https://docs.github.com/en/graphql/overview/explorer