This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go | |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Key media control for niconico | |
// @namespace https://htsign.hateblo.jp | |
// @version 0.9.6 | |
// @description ニコニコ動画本体側でいろいろ便利になった結果、今は音量を表示させる機能と次の動画を自動再生させない機能のみ | |
// @author htsign | |
// @match https://www.nicovideo.jp/watch/* | |
// @match https://live.nicovideo.jp/watch/* | |
// @updateURL https://gist.github.com/htsign/014c9b053f5eb62791fc04570ce79dcc/raw/MediaControlNiconico.user.js | |
// @downloadURL https://gist.github.com/htsign/014c9b053f5eb62791fc04570ce79dcc/raw/MediaControlNiconico.user.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExceptionWrapper { | |
@SuppressWarnings("unchecked") | |
public static <T, E extends Exception> T exec(ThrowableSupplier<T, E> func, Function<E, T> orElse) { | |
try { | |
return func.getThrowable(); | |
} | |
catch (WrapperException e) { | |
Throwable cause = e.getCause(); | |
if (cause instanceof Exception) { | |
return orElse.apply((E) cause); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,2a,00,7b,00,36,00,79,00,00,00,00,00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Monad = struct | |
module type MonadType = sig | |
type 'a t | |
val map : ('a -> 'b) -> 'a t -> 'b t | |
val return : 'a -> 'a t | |
val apply : ('a -> 'b) t -> 'a t -> 'b t | |
val flatmap : ('a -> 'b t) -> 'a t -> 'b t | |
end | |
module type MonadType2 = sig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Stdlib.List | |
let scan f ?init xs = | |
let scan' xs = | |
let rec aux acc xs = | |
match acc, xs with | |
| _, [] -> acc | |
| [], x :: xs -> aux [x] xs | |
| x :: _, y :: ys -> aux (f x y :: acc) ys | |
in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Stdlib.Seq | |
let cons x xs = fun () -> Cons (x, xs) | |
let rev xs = | |
let rec aux acc ys = | |
match ys () with | |
| Nil -> acc | |
| Cons (y, ys) -> aux (cons y acc) ys | |
in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Option = struct | |
let bind (f : 'a -> 'b option) : 'a option -> 'b option = function None -> None | Some x -> f x | |
let map (f : 'a -> 'b) : 'a option -> 'b option = function None -> None | Some x -> Some (f x) | |
end | |
module Stream = struct | |
include Stream | |
let map (f : 'a -> 'b) (strm : 'a Stream.t) : 'b Stream.t = | |
Stream.from (fun _ -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Auto change settings for Wandbox | |
// @namespace https://htsign.hateblo.jp | |
// @version 0.3.3 | |
// @description save settings for each languages | |
// @author htsign | |
// @include https://wandbox.org/* | |
// @downloadURL https://gist.github.com/htsign/d06bc205c00b843aba52d18ebfb3310d/raw/settings-for-wandbox.user.js | |
// @updateURL https://gist.github.com/htsign/d06bc205c00b843aba52d18ebfb3310d/raw/settings-for-wandbox.user.js | |
// @grant none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Option | |
{ | |
public static Option<T> Create<T>(T? value) => value != null ? new Some<T>(value) : Option<T>.None; | |
public static None<dynamic> None { get; } = new None<dynamic>(); | |
} | |
public abstract class Option<T> : IEquatable<Option<T>> | |
{ | |
public static Option<T> None { get; } = new None<T>(); |