Skip to content

Instantly share code, notes, and snippets.

View htsign's full-sized avatar
🤔

htsign htsign

🤔
View GitHub Profile
// ==UserScript==
// @name Hatena bookmark compatibility for DuckDuckGo
// @description add Hatebu images for DuckDuckGo
// @namespace https://htsign.hateblo.jp
// @version 0.0.11
// @author htsign
// @match https://duckduckgo.com/?*
// @updateURL https://gist.github.com/htsign/700c4ea725acb9e38c97900b1aa04633/raw/hatebu-for-duckduckgo.user.js
// @downloadURL https://gist.github.com/htsign/700c4ea725acb9e38c97900b1aa04633/raw/hatebu-for-duckduckgo.user.js
// @grant GM_xmlhttpRequest
// ==UserScript==
// @name Embedded YouTube fix
// @description this monitors and auto-refreshes crashed embedded YouTube players in the background for a seamless viewing experience
// @namespace https://htsign.hateblo.jp
// @version 0.5.5
// @author htsign
// @match *://*/*
// @match https://www.youtube.com/embed/*
// @updateURL https://gist.github.com/htsign/cc246428156299e2028e87813d3b95d8/raw/Embedded-YouTube-fix.user.js
// @downloadURL https://gist.github.com/htsign/cc246428156299e2028e87813d3b95d8/raw/Embedded-YouTube-fix.user.js
@htsign
htsign / MyMath.cs
Last active November 9, 2025 05:08
標準偏差を求めるメソッドを生やしました。なるべく汎用的に、高速に動作するよう作ったつもりですが実測はしていないので微妙。
public static class MyMath
{
public interface ITypeConverter<T, TResult>
{
TResult Convert(T value);
}
/// <summary><c>TResult.CreateChecked</c> を用いて型変換を行います。</summary>
public readonly struct CheckedTypeConverter<T, TResult> : ITypeConverter<T, TResult>
where T : INumberBase<T>
// ==UserScript==
// @name YouTube Comment Username Reveals
// @description add user name for comment
// @namespace https://htsign.hateblo.jp
// @version 0.3.12
// @author htsign
// @match https://www.youtube.com
// @match https://www.youtube.com/*
// @match https://m.youtube.com
// @match https://m.youtube.com/*
@htsign
htsign / MathmaticalAlphanumericSymbols.dic
Last active April 6, 2024 09:16
Mathmatical Alphanumeric Symbols dictionary for SKK system
;; -*- mode: fundamental; coding: utf-8 -*-
;; Mathmatical Alphanumeric Symbols dictionary for SKK system
;;
;; https://www.asahi-net.or.jp/~ax2s-kmtn/ref/unicode/u1d400.html
;;
;; okuri-nasi entries
A /𝔸/
B /𝔹/
C /ℂ/
D /𝔻/
@htsign
htsign / hatebu-for-bing.user.js
Last active March 23, 2023 12:34
はてブの「○○ users」を Bing に追加する
// ==UserScript==
// @name Hatena bookmark compatibility for Bing
// @namespace https://htsign.hateblo.jp
// @version 0.0.3
// @description add Hatebu images for Bing
// @author htsign
// @match https://www.bing.com/search?*
// @downloadURL https://gist.github.com/htsign/b2c913f28e4b8646d0b30c4170e7d34c/raw/hatebu-for-bing.user.js
// @updateURL https://gist.github.com/htsign/b2c913f28e4b8646d0b30c4170e7d34c/raw/hatebu-for-bing.user.js
// @grant none
@htsign
htsign / main.ml
Last active September 9, 2023 13:16
let string_of_list ~to_string xs =
"[" ^ String.concat "; " (List.map to_string xs) ^ "]"
let string_of_opt ~to_string =
function None -> "None" | Some x -> Printf.sprintf "Some(%s)" @@ to_string x
let () =
let print_optlist theme xs =
let xs = OptionList.to_optlist xs in
let lstr = string_of_list ~to_string:(string_of_opt ~to_string:string_of_int) xs in
module List = struct
include Stdlib.List
let hd_opt xs = try Some (hd xs) with Failure _ -> None
end
let char_list_of_string string =
let rec aux acc idx =
if idx >= 0 then
(* libraries definitions *)
(* Haskell's Data.Function.on implementation in OCaml *)
module Data : sig
module Function : sig
val on : ('b -> 'b -> 'c) -> ('a -> 'b) -> ('a -> 'a -> 'c)
end
end = struct
module Function = struct
let on bf f = fun x y -> bf (f x) (f y)
@htsign
htsign / List.ml
Created March 10, 2022 17:31
OCaml `List.group_by`
module List = struct
include Stdlib.List
let group_by (projection : 'a -> 'key) (xs : 'a list) : ('key * 'a list) list =
let pairs = xs |> List.map (fun x -> projection x, x) in
let rec aux acc = function
| [] -> acc |> List.rev
| ((k, _) :: _) as xs ->
let ys, zs = xs |> List.partition (fun t -> fst t = k) in