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 / 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 / base94.c
Created November 11, 2012 09:05
base94 encoder/decoder
#include "base94.h"
void base94_encode(const unsigned char *plain, unsigned char *code) {
// high * 2^64 | low
unsigned long long value
= ((unsigned long long)plain[1] << 56) | ((unsigned long long)plain[2] << 48)
| ((unsigned long long)plain[3] << 40) | ((unsigned long long)plain[4] << 32)
@iso2022jp
iso2022jp / zipper.html
Created December 14, 2024 09:35
ZIP on the web
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web Zipper</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
@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 / vlw-viewer.html
Created May 15, 2021 11:30
VLW font viewer
<!doctype html>
<html class="h-100">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>VLW viewer</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/mustache@4.2.0/mustache.min.js"></script>
@iso2022jp
iso2022jp / wslm.cmd
Last active November 2, 2023 03:01
Run wls on the host directory with SMB
@echo off
: Prerequisite: share C: with "C", user "foo" accessible
wsl -- ^
set -euxo pipefail; ^
[[ ! -d /mnt/c2 ]] ^|^| mount ^| grep '/mnt/c2' ^|^| sudo find '/mnt/c2' -type d -empty -delete; ^
[[ -d /mnt/c2 ]] ^|^| sudo mkdir /mnt/c2; ^
grep -qs '/mnt/c2 ' /proc/mounts ^|^| sudo mount -t cifs -o user=foo,nobrl,noperm,cache=none,actimeo=0,iocharset=utf8 //$^(grep nameserver /etc/resolv.conf ^| grep '\.' ^| cut -f2 -d' '^)/C /mnt/c2; ^
cd ${PWD/#\/mnt\/c\///mnt/c2/}; ^
@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 / wifi-selector.ino
Created May 29, 2021 16:18
M5Stack Core2 で Wi-Fi に接続する GUI(入力辛い系)
#include <M5Core2.h>
#include <WiFi.h>
//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2
void selectWiFi(String &ssid, uint8_t &encType, int32_t &rssi, uint8_t* &bssid, int32_t &channel) {
auto& d = M5.Lcd;
d.fillScreen(BLACK);