Skip to content

Instantly share code, notes, and snippets.

@syusui-s
syusui-s / use_react_in_userscript.user.js
Last active June 18, 2021 03:51
React + UserScript 名前空間の汚染/モジュールバンドラー/JSX/トランスパイラなしにReactをUserScriptで使う方法 / Example of using React in UserScript without global namespace pollution, module bundler, JSX and transpiler.
// ==UserScript==
// @name Use React in UserScript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description This example shows how to use React in UserScript without global namespace pollution.
// @author You
// @match *
// @grant none
// ==/UserScript==
@syusui-s
syusui-s / discord_mute.user.js
Last active December 4, 2020 16:12
Discord Mute Shortcut (Alt + M)
// ==UserScript==
// @name Discord Mute
// @namespace https://gist.github.com/syusui-s/1ab91b3cb9ddc60d623e7a9caeb6fb63
// @version 0.1
// @description try to take over the world!
// @author syusui_s
// @match https://discord.com/channels/*
// @grant none
// @updateURL https://gist.github.com/syusui-s/1ab91b3cb9ddc60d623e7a9caeb6fb63/raw/discord_mute.user.js
// @downloadURL https://gist.github.com/syusui-s/1ab91b3cb9ddc60d623e7a9caeb6fb63/raw/discord_mute.user.js
@syusui-s
syusui-s / highlight_stackexchange_source.user.js
Last active November 11, 2021 09:10
StackExchange Source Highlight: 転載サイトで StackOverflow, SuperUser等のStackExchangeサービスへのリンクをハイライトするUserScriptです(Chrome拡張機能)
// ==UserScript==
// @name StackExchange Source Highlight
// @namespace https://gist.github.com/syusui-s/67a81c0b7357e86b9531746bc84f22ce/
// @version 1.4.0
// @description 転載サイトで StackOverflow, SuperUser等のStackExchangeサービスへのリンクをハイライトします
// @license CC0-1.0
// @author syusui-s
// @match https://codeday.me/*
// @match https://*.coder.work/*
// @match https://www.366service.com/jp/qa/*
# pavucontrol で ↓のように設定すると上手くいく
# ゲームの出力 → GameSink
# Discordの入力 → DiscordSink
# 注意: レイテンシが数msあるはずなので、FPSやリズムゲームには向いてない
# 恐らく、GameSinkにnull-sinkを使うかわりに、combine-sinkを使うと良い気がする(combine-sinkもmonitorできたはず)
case "$1" in
load)
# ゲーム 出力用
# curl 'http://ws.example.com/ws' \
# -H 'Pragma: no-cache' \
# -H 'Origin: http://ws.example.com/' \
# -H 'Accept-Language: ja-JP,ja;q=0.9,en;q=0.8' \
# -H 'Sec-WebSocket-Key: BASE64_NONCE' \
# -H 'Upgrade: websocket' \
# -H 'Sec-WebSocket-Version: 13' \
# --compressed \
# --output ~/out
#
const sleep = (ms: number) : Promise<unknown> => new Promise(resolve => setTimeout(resolve, ms));
const retry = async <Args extends any[], Result>(
count: number,
interval: number,
fn: (...args: Args) => Promise<Result>,
...args: Args
) => {
for (let i = 0; i < count; ++i) {
const result = await fn(...args);
const assert = (pred) => { if (! pred) throw new Error("Assertion failed"); };
class Connection {
constructor(prevs, next) {
if (prevs.length != next.weights.length) {
throw new RangeError("prevs length should be equal to next weights length");
}
if (! prevs.map(p => p.weights.length).reduce((x, y) => x && x == y ? x : false)) {
throw new RangeError("all perceptron in prevs should have same weights length");
class S {
sProps: string = "sProps"
}
class C extends S {
cProps: string = "cProps"
}
type Predicate<T> = (value: T) => boolean;

Scrapbox Sticky Video

  • ScrapboxでYouTube等の動画を上部に固定表示できるようにするUserStyle/UserCSSです。
  • lefb766/scrapbox-video-seek-buttonと組み合わせて使うことを意図しています。
  • CC0 ライセンスで公開します。
code:style.css
  .video-line {
 position: sticky;

LiunxでNEUTRINO(AIきりたん)をうごかす

Requirements

  • Wineを入れておく

Tips

musicxmlの作り方

  • LMMSで打ち込む
  • MIDIにエクスポートしておく(LMMS1.2以上)
  • musescoreでインポートする