Skip to content

Instantly share code, notes, and snippets.

@kotobukid
kotobukid / giraffe_banisher.js
Created May 8, 2024 08:32
WIXOSSのサイトにアクセスしたときに表示されるみまもりフィルターに、次回以降自動的に同意する
// ==UserScript==
// @name Giraffe Banisher
// @namespace http://tampermonkey.net/
// @version 2024-05-08
// @description try to take over the world!
// @author You
// @match https://www.takaratomy.co.jp/products/wixoss/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=takaratomy.co.jp
// @grant none
// ==/UserScript==
@kotobukid
kotobukid / userscript.js
Created May 8, 2024 06:32
Redmine右上の検索欄に数値を入れたときにチケットにダイレクトジャンプしてしまう問題を回避する微ハック
// ==UserScript==
// @name Redmine query trick
// @namespace http://tampermonkey.net/
// @version 2024-05-08
// @description try to take over the world!
// @author You
// @match http://example.com/*
// @icon
// @grant none
// ==/UserScript==
@kotobukid
kotobukid / userscript.js
Created April 27, 2024 13:52
超ワイドにホームタイムラインを表示しよう
// ==UserScript==
// @name Wide Twitter
// @namespace http://tampermonkey.net/
// @version 2024-04-26
// @description try to take over the world!
// @author You
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
[package]
name = "sample"
version = "0.1.0"
edition = "2021"
[dependencies]
axum = "0.7.4"
http = "1.1.0"
tower = "0.4.13"
tracing-subscriber = "0.3.18"
// ==UserScript==
// @name second redmine favicon
// @namespace http://tampermonkey.net/
// @version 2024-04-20
// @description try to take over the world!
// @author You
// @match http://example.com/*
// @grant none
// ==/UserScript==
@kotobukid
kotobukid / middleware.rs
Created April 10, 2024 16:55
Axumでミドルウェアでセットした値をリクエストハンドラで取得する
use std::net::SocketAddr;
use std::sync::Arc;
use axum;
use axum::response::IntoResponse;
use axum::{routing::{get, post}, Router, response::Html, Json, http::StatusCode, extract::Form, Extension};
use tower_http::trace::TraceLayer;
use axum::{
body::{Body, Bytes},
extract::Request,
@kotobukid
kotobukid / subscribe.ts
Last active March 28, 2024 07:27
1つのRedis接続インスタンスで複数のチャンネルをsubscribeできるか
import Redis from "ioredis";
const redis = new Redis();
redis.on('message', (ch: string, mes: string): void => {
console.log({
ch,
mes
});
});
@kotobukid
kotobukid / main.rs
Created March 26, 2024 06:41
TauriとAxumで状態を共有する
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use axum::{routing::get, Router};
use std::net::SocketAddr;
use std::sync::{Arc, Mutex};
use axum::response::IntoResponse;
use tower_http::{
trace::TraceLayer,
@kotobukid
kotobukid / asyncjs_typed.ts
Created March 6, 2024 03:30
asyncjsのよくありそうな処理に型を律義につけるとこうなるらしい
import async, {AsyncFunction, AsyncResultArrayCallback} from "async";
const main = (): void => {
const funcs0: AsyncFunction<number, Error>[] = [1, 2, 3].map((num: number): AsyncFunction<number, Error> => {
return (callback: (err: Error | null, result?: number) => void): void => {
callback(null, num * 2);
}
});
const after: AsyncResultArrayCallback<number, Error> = (errors: Error | undefined | null, results: (number | undefined)[] | undefined): void => {
@kotobukid
kotobukid / noop_template.py
Last active January 1, 2024 11:38
Blender Add-onサンプル
bl_info = {
"name": "Simple UV Editor Panel",
"author": "kotobukid",
"version": (1, 0),
"blender": (4, 0, 1),
"location": "UV Editor > Sidebar",
"description": "Adds a simple panel to the UV Editor",
"category": "UV",
}