Skip to content

Instantly share code, notes, and snippets.

View unarist's full-sized avatar

unarist unarist

View GitHub Profile
@unarist
unarist / index.html
Last active March 12, 2022 13:00
SpaceMouseを押すと青く光って音がなるやつ。要WebHID=Chromeのみ。
<ol>
<li>音声ファイルを選ぶ: <input type="file"></li>
<li><button>connect</button> を押してSpaceMouseを選んで接続する</li>
<li>押すと光って音がなる(Windowsとかだと Stop 3DxWare してからやるといい感じ)</li>
</ol>
<script>
let audioUrl = undefined;
document.querySelector('input').onchange = ({target}) => {
const file = target.files[0];
audioUrl = file ? URL.createObjectURL(file) : undefined;
@unarist
unarist / hid-inputs-viewer.html
Created February 22, 2022 13:17
WebHIDでInputReportをReportID別に眺めるやつ
<!-- inspired by https://nondebug.github.io/webhid-explorer/ -->
<!-- license: CC0 -->
<button>Connect HID device</button>
<script>
const t = (e,p) => Object.assign(document.createElement(e), p);
const addSection = (title) => {
const header = t("h3", {textContent: title});
const textarea = t("textarea", {
// ==UserScript==
// @name gh - show approvals
// @namespace https://github.com/unarist
// @version 0.3
// @author unarist
// @match https://github.com/*
// @grant none
// @downloadURL https://gist.github.com/unarist/c45bd5e8102afe7ce27d757a87819ea4/raw/github-show-approvals.user.js
// @run-at document-idle
// @noframes
[core]
autocrlf = False
[fetch]
prune = true
[push]
default = current
[pull]
ff = only
[alias]
sd = diff --color-words
open System
open System.Windows.Automation
module Screen =
open System.Windows.Forms
open System.Drawing
let workingAreaFor (rect: System.Windows.Rect) =
let rect = new Rectangle(int rect.X, int rect.Y, int rect.Width, int rect.Height)
let workingArea = (Screen.FromRectangle rect).WorkingArea
new System.Windows.Rect(float workingArea.X, float workingArea.Y, float workingArea.Width, float workingArea.Height)
@unarist
unarist / README.md
Last active April 27, 2021 12:59
Wikipediaで他言語版のリンクをh1の隣に持ってくる.user.js

これはなに

他言語版のリンクをh1の隣に持ってくるやつ。

image

ja,en,itという並びは適当。

@unarist
unarist / github-lightbox.user.js
Last active April 27, 2021 12:59
githubのissue/prでクリックすると画像を大きくするやつ
// ==UserScript==
// @name github - lightbox
// @namespace https://github.com/unarist/
// @version 0.1
// @author unarist
// @match https://github.com/*/*/issues/*
// @match https://github.com/*/*/pull/*
// @grant none
// @downloadURL https://gist.github.com/unarist/982dcff096062f53406bf0ab5d470744/raw/github-lightbox.user.js
// @license MIT License
// ==UserScript==
// @name github - indent lines
// @namespace https://github.com/unarist/
// @version 0.1
// @description Tab/Shift+Tabでカーソル位置・選択行をインデント・アンインデント
// @author unarist
// @match https://github.com/*
// @grant none
// @downloadURL https://gist.github.com/unarist/a184bf5d936c82bed14007a56e8abfae/raw/github-indent-lines.user.js
// @run-at document-idle
@unarist
unarist / mastodon-mstdbg.user.js
Last active February 8, 2021 09:11
Mastodon - Add debug tools to window.mstdbg
// ==UserScript==
// @name Mastodon - Add debug tools to window.mstdbg
// @namespace https://github.com/unarist
// @version 0.5
// @description no description :)
// @author unarist
// @match https://*/web/*
// @require https://unpkg.com/axios/dist/axios.min.js
// @grant none
// @downloadURL https://gist.github.com/unarist/9722831a794b5537dc0f749ee49da55a/raw/mastodon-mstdbg.user.js
@unarist
unarist / parse-ebml.ts
Last active February 7, 2021 18:39
DenoでEBMLパース
import { DOMParser, Element } from "https://deno.land/x/deno_dom@v0.1.3-alpha2/deno-dom-wasm.ts";
// https://github.com/ietf-wg-cellar/ebml-specification/blob/master/specification.markdown#ebml-header-elements
let elementDefs = [
{ path: "\\EBML", id: 0x1A45DFA3, type: "master" },
{ path: "\\EBML\\EBMLVersion", id: 0x4286, type: "uinteger" },
{ path: "\\EBML\\EBMLReadVersion", id: 0x42F7, type: "uinteger" },
{ path: "\\EBML\\EBMLMaxIDLength", id: 0x42F2, type: "uinteger" },
{ path: "\\EBML\\EBMLMaxSizeLength", id: 0x42F3, type: "uinteger" },
{ path: "\\EBML\\DocType", id: 0x4282, type: "string" },