Skip to content

Instantly share code, notes, and snippets.

View iso2022jp's full-sized avatar
🌌
Working in the metaverse

USHIDO Hiroyuki iso2022jp

🌌
Working in the metaverse
View GitHub Profile
@iso2022jp
iso2022jp / zip.js
Last active October 10, 2026 10:55
Browser only ZIP support
// @ts-check
// ISO/IEC 21320-1
const DEFAULT_THROTTLE_MS = 16 // 60 FPS
/** @typedef {ZipItem|File|FileSystemHandle|FileSystemEntry} ZipSource */
/** @typedef {AsyncIterable<ZipSource>|Iterable<ZipSource|PromiseLike<ZipSource>>} ZipSourceItems */
/**
@iso2022jp
iso2022jp / efficiency-power-mode.cmd
Created September 15, 2026 04:44
Set Power Mode to Best Power Efficiency
<# :
@echo off
powershell -nop -ep Bypass -c "iex (cat '%~f0' -Raw)"
goto :eof
#>
$definition = @'
[DllImport("powrprof")]
public static extern uint PowerSetActiveOverlayScheme(Guid OverlaySchemeGuid);
'@
@iso2022jp
iso2022jp / base32.js
Created November 4, 2025 00:35
Base32
'use strict';
// @ts-check
/**
* The Base 32 Encoding and Base 32 Encoding with Extended Hex Alphabet
*
* This module provides Base32 encoding and decoding functionality similar to Uint8Array's Base64 methods
* @see https://www.rfc-editor.org/rfc/rfc4648.html#section-6
* @see https://www.rfc-editor.org/rfc/rfc4648.html#section-7
*/
@iso2022jp
iso2022jp / http-structured-field.js
Created September 23, 2025 07:04
Structured Field Values for HTTP
'use strict';
const base32 = require('./base32'); // IETF HTTP Working Group Structured Field Tests JSON Schema support
/** @module RFC9651 */
/**
* Structured Field Values for HTTP
* @see https://www.rfc-editor.org/rfc/rfc9651.html#name-working-with-structured-fie
*/
@iso2022jp
iso2022jp / emoji-clock.bashrc
Created November 19, 2024 12:45
🕤 Bash emoji clock prompt
eclock () { echo -e $( printf '\\U1F5%x' $(( 0x4f + $(date +%-I) + ($(date +%-M) >= 30) * 12 )) ) ; }
export PS1='$(eclock) '"$PS1"
@iso2022jp
iso2022jp / git-cp
Last active September 16, 2024 02:33
Copy a single file from the remote git registory.
#!/bin/bash
# Copy the single file from the remote git registory.
set -euo pipefail
if [[ $# -lt 3 ]]; then
echo "Usage: $0 <repos> <branch> <src> [<dest>]">&2
exit 1;
fi
@iso2022jp
iso2022jp / mermaid-for-backlog.user.js
Last active June 29, 2024 09:12
Mermaid support for the Backlog web site.
// ==UserScript==
// @name mermaid-for-backlog
// @namespace https://gist.github.com/iso2022jp
// @version 0.4
// @description Mermaid support for the Backlog web site.
// @author USHIDO Hiroyuki
// @match *://*.backlog.jp/*
// @match *://*.backlog.com/*
// @grant none
// @run-at document-end
@iso2022jp
iso2022jp / update-factorio
Last active March 24, 2025 03:25
Factorio Headless Updater
#!/bin/bash
set -euo pipefail
DRYRUN=''
DOWNLOAD_ONLY=''
usage() {
echo "Usage: $0 [-n|-d]" 1>&2
exit 1
@iso2022jp
iso2022jp / WheelBackflowCanceller.cs
Last active May 6, 2023 06:18
Mouse wheel back-flow canceller for Microsoft Pro IntelliMouse
using System;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
// [main: STAThread]
Thread.CurrentThread.SetApartmentState(ApartmentState.Unknown);
Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
@iso2022jp
iso2022jp / _.js
Created May 2, 2023 10:47
Chunked "Content" Encoding transformer
class ChunkedTransformer {
#trasformLastChunk
#chunks
#header
// BWS: [ \t]*
// token: [-!#-'*+.^`|~\w]+
// quoted-string: "(?:[\t \x21\x23-\x5B\x5d-\x7E\x80-\xFF]|\\[\t \x21-\x7E\x80-\xFF])*"