Skip to content

Instantly share code, notes, and snippets.

@okinjp
okinjp / kuku_domains.txt
Last active December 7, 2024 21:00
Manual update. No guarantee.
addrin.uk
ak.gy
akugu.com
aquapal.net
bangban.uk
boxfi.uk
catbar.net
catgroup.uk
ccmail.uk
choco.la
@okinjp
okinjp / gen-meta.sh
Created July 20, 2024 14:29
Misskey/Firefish派生向け絵文字インポートzip用meta.json生成スクリプト
#!/usr/bin/env bash
## 使い方 ##
# 1. インポートしたい絵文字画像を一つのフォルダに置く
# 2. 絵文字画像ファイルの名前を登録名にする
# 3. このシェルスクリプトのlicenseとcategoryを修正してフォルダで実行する
# 4. 作成されたmeta.jsonと画像ファイルをzip圧縮する
# 5. Misskey/Firefish派生でインポートする
## End ##
array=($(echo $(ls -1|grep -v "json")))
category=$(basename $(pwd))
@okinjp
okinjp / gen_mastodon_icons.sh
Created March 19, 2024 13:34
Generate resized icons for mastodon
#!/bin/bash
if [ -z $(which convert) ];then
echo "Missing ImageMagick. Aborted."
exit 1
fi
TARGET_IMAGE=${1}
if [ -z "${TARGET_IMAGE}" ] || [ ! -f "${TARGET_IMAGE}" ];then
echo "Missing image. Aborted."
exit 2
fi
@okinjp
okinjp / add_search_button.conf
Last active March 3, 2024 14:39
Add search button for misskey
# 使い方
# nginxのsub_filerで検索ボタンを生み出すJSをねじ込むコンフィグファイルです。
# 必要なところ(location /など)に以下の行を追加します。
# include add_search_button.conf;
proxy_set_header Accept-Encoding "";
sub_filter '</html>' '<script>const searchUrls=new Map([["ますみすサーチ","https://masmis-search.ja-jp.org/search?q="],["notestock","https://notestock.osa-p.net/view?q="]]);function arylike2ary(e){for(var t=[],n=0,a=e.length;n<a;++n)t.push(e[n]);return t}function waitForElement(e,t,n,a){const c=Date.now();!function o(){if(null!=document.querySelector(e))return void t();setTimeout((()=>{a&&Date.now()-c>a||o()}),n)}()}function add_plus_search_button(e){let t,n=arylike2ary(document.getElementsByTagName("button"));for(let e=0;e<n.length;e++){const a=n[e];if(a.innerText.includes("検索")){t=a;break}}let a=document.createElement("div");a.innerHTML=t.parentNode.innerHTML.replace("検索",e+"で検索"),a=t.parentNode.parentNode.appendChild(a),a.getElementsByTagName("button")[0].addEventListener("click",(()=>{let t=document.getElementsByTagName("input")[0].value;""!=t&&window.op
# ddclinet 3.10以降向け
# 1. zone nameはCloudflare上の登録ドメイン
# www.example.com なら examle.com
# 2. emailはCloudflare登録メールアドレス
# 3. apikeyはCloudflare -> My profile -> API Tokensから発行
# 4. crontabで自動化する場合
# * * * * * ddclient --file <config file path>
# Aレコード用にIPアドレスを返すサイトをwebに指定する
# https://api.ipify.org/ など
@okinjp
okinjp / authorize_interaction.php
Last active April 30, 2024 09:36
みおきー・みーくりあ!・ふぃーお!で使われているauthorize_interaction(PHP製)の処理(抜粋)
<?php
$show_api = "/api/ap/show";
$instance = "mi.okin-jp.net";
// クエリからuriを取得
$uri = isset($_GET['uri']) ? $_GET['uri'] : "";
// ログインユーザーのトークンを取得
$authi = isset($_COOKIE['token']) ? $_COOKIE['token'] : "";
// エラーハンドリング
if ($authi == "" || $uri == "") {
@okinjp
okinjp / podman.sh
Last active October 30, 2023 08:34
Shellscript for podman compose as podman-compose
#!/usr/bin/env bash
####
# Notice: This script must be in /usr/local/bin because the default "podman" is in /usr/bin and the shell prefers commands from /usr/local/bin over /usr/bin.
#
# How to install this script on your computer.
# 1. Open your terminal
# 2. Copy
# "
# sudo curl -Ls https://ip1.info/gist_dl/get_podman_sh.php -o /usr/local/bin/podman && sudo chmod +x /usr/local/bin/podman
# "
@okinjp
okinjp / alt_realpath.sh
Last active October 30, 2023 08:48
簡易に絶対パスを返すスクリプト
#!/usr/bin/env bash
# 第一引数がパスで第二引数以降は単純に引き渡せればいい場合は$1の代わりに$@も可
PATHTO = $1
if [[ "$PATHTO" = "/"* ]] || [[ "$PATHTO" = "~"* ]];then
PATHPREFIX=""
else
PATHPREFIX="$(pwd)/"
fi
echo "$PATHPREFIX$PATHTO"
@okinjp
okinjp / misskey-nginx.conf
Last active July 27, 2024 17:19
misskey向けのNginxリバースプロキシ設定
# For WebSocket
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
proxy_cache_path /tmp/mi_cache levels=1:2 keys_zone=cache1:16m max_size=1g inactive=720m use_temp_path=off;
server {
listen 80;
@okinjp
okinjp / script_dir.sh
Last active October 30, 2023 08:48
Get SCRIPT_DIR and REAL_SCRIPT_DIR
#!/usr/bin/env bash
# SCRIPT_DIR is the directory for scripts without considering symbolic links
SCRIPT_DIR=$(cd $(dirname $0); pwd)
# SCRIPT_DIR is the real directory for scripts with considering symbolic links
REAL_SCRIPT_DIR=$(cd $(dirname $(realpath $0)); pwd)