Skip to content

Instantly share code, notes, and snippets.

View toggl-quickimport.user.js
// ==UserScript==
// @name Toggl - Quick import
// @description (<mm><dd> )?(<hh><mm>(<description><hh><mm>)+ )+
// @namespace https://github.com/unarist/
// @version 0.1
// @author unarist
// @match https://www.toggl.com/app/timer
// @grant GM_registerMenuCommand
// @downloadURL https://gist.github.com/unarist/559e02233b5e5dc4859885041c076190/raw/toggl-quickimport.user.js
// ==/UserScript==
View codepages_nlp.hexpat
// structures are based on https://github.com/dotnet/runtime/blob/v6.0.7/src/libraries/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs
struct CodePageHeader {
char16 codePageName[16];
u16 version[4];
u16 codePage;
u16 byteCount;
u32 offset;
u16 unicodeReplace;
u16 byteReplace;
@unarist
unarist / index.html
Last active Mar 12, 2022
SpaceMouseを押すと青く光って音がなるやつ。要WebHID=Chromeのみ。
View index.html
<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 Feb 22, 2022
WebHIDでInputReportをReportID別に眺めるやつ
View hid-inputs-viewer.html
<!-- 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", {
View autoresize.fs
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)
View github-indent-lines.user.js
// ==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 / parse-ebml.ts
Last active Feb 7, 2021
DenoでEBMLパース
View parse-ebml.ts
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" },
View github-show-approvals.user.js
// ==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
@unarist
unarist / mastodon-min_id-autoscroll.user.js
Created May 26, 2020
Mastodon - Jump to the bottom on min_id pages
View mastodon-min_id-autoscroll.user.js
// ==UserScript==
// @name Mastodon - Jump to the bottom on min_id pages
// @namespace https://github.com/unarist/
// @version 0.1
// @author unarist
// @match https://*/@*
// @downloadURL https://gist.github.com/unarist/654da43b13108d30d6dbb602e42cd6d8/raw/mastodon-min_id-autoscroll.user.js
// @grant none
// @noframes
// @run-at document-idle
@unarist
unarist / github-lightbox.user.js
Last active Apr 27, 2021
githubのissue/prでクリックすると画像を大きくするやつ
View github-lightbox.user.js
// ==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