Skip to content

Instantly share code, notes, and snippets.

View TwoSquirrels's full-sized avatar

りすりす/TwoSquirrels TwoSquirrels

View GitHub Profile
@TwoSquirrels
TwoSquirrels / wsh-checklist.md
Last active March 22, 2025 01:29
Web Speed Hackathon チェックリスト

Web Speed Hackathon チェックリスト ver.2025032210

SPDX-FileCopyrightText: Copyright (c) 2025 TwoSquirrels
SPDX-License-Identifier: MIT

りすりす/TwoSquirrels が WSH 用にまとめた、Web サイトチューニングのチェックリストです。このリストの項目を 1 つずつ対応していけば、機械的にある程度チューニングができるはずです。ご自由にお使いください!(WSH 用なので、キャッシュ周りについては省いています)

1. WSH 事前準備

  • 環境構築はできていますか?
@TwoSquirrels
TwoSquirrels / qr.lua
Created January 30, 2025 03:59
QR code generator for Computer Craft
-- SPDX-FileCopyrightText: 2025 TwoSquirrels
-- SPDX-License-Identifier: Apache-2.0
local qrencode = dofile("luaqrcode/qrencode.lua")
--- Generate a QR code matrix with padding.
--- @param text string the text to encode
--- @return boolean[][]|nil matrix the QR code matrix or nil if failed
local function qrcode(text)
local ok, tab = qrencode.qrcode(text)
@TwoSquirrels
TwoSquirrels / README.md
Last active November 24, 2024 21:46
システム英単語テストジェネレータ
@TwoSquirrels
TwoSquirrels / energy.sh
Created July 24, 2023 08:23
電気使用率取得コマンド
# energy
# oneline: curl -s 'http://agora.ex.nii.ac.jp/earthquake/201103-eastjapan/energy/electrical-japan/info.json' | jq '[.tokyo.time, .tokyo.percentage][]' | tr '\n' ' ' | xargs -n2 bash -c 'echo "$0 現在、東京電力の供給量に対する電力使用率は $1% です"'
function energy() {
error=0
url='http://agora.ex.nii.ac.jp/earthquake/201103-eastjapan/energy/electrical-japan/info.json'
json=$(curl --silent --max-time 2 "$url" || error=1)
[ -z "$json" ] && error=1
[ $error -ne 0 ] && {
echo '電気使用率が取得できませんでした'
return 1
@TwoSquirrels
TwoSquirrels / ajl2023-h3-ranking.js
Created June 27, 2023 15:10
AJL2023 高3 個人ランキング 平均ソート表示
// SPDX-License-Identifier: MIT
"use strict";
const tabletojson = require("tabletojson").Tabletojson;
console.log(
`\n### AJL2023 高3 個人ランキング (${new Date().toLocaleDateString()}時点)\n`
);
@TwoSquirrels
TwoSquirrels / ハイフンと似た記号.md
Created June 14, 2023 15:18
ハイフンと似た記号

ハイフンと似た記号

-(全角ハイフンマイナス)
-(半角ハイフンマイナス)
‐(全角ハイフン)
−(全角マイナス)
‒(フィギュアダッシュ)
—(全角ダッシュ)
–(二分ダッシュ)
@TwoSquirrels
TwoSquirrels / SimpleGrapplingHook.java
Last active January 29, 2023 15:33
Simple Grappling Hook Spigot Plugin
// SPDX-License-Identifier: CC0
package io.github.twosquirrels.simplegrapplinghook;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
@TwoSquirrels
TwoSquirrels / 画像保存ブックマークレット.md
Last active July 23, 2023 11:42
画像保存ブックマークレット

画像保存ブックマークレット

This bookmarklet downloads up to four images from a Twitter page, and names them based on the username, tweet ID, and image number. It only works on Twitter pages and will throw an error if run on a different website.

Bookmarklet

javascript:(async()=>{if(location.hostname.match(/\.?twitter\.com$/)){let[,t,,e]=location.pathname.split("/");return[...document.getElementsByTagName("img")].filter(t=>t.src.startsWith("https://pbs.twimg.com/media/")).slice(0,4).map((a,c)=>({url:a.src.replace(/&name=.+/,""),name:`Title-twitter-${t}-${e}-${c+1}.jpg`}))}throw Error("This page is not supported.")})().then(t=>t.forEach(async({url:t,name:e})=>{let a=document.createElement("a");a.href=URL.createObjectURL(await (await fetch(t,{mode:"cors"})).blob()),a.download=e,a.click()})).catch(t=>alert(t))
@TwoSquirrels
TwoSquirrels / 塗り絵ブックマークレット.md
Last active December 29, 2022 14:50
塗り絵ブックマークレット

塗り絵ブックマークレット

これをブックマークに登録するのだ!

背景色のみ

javascript:[...document.querySelectorAll("*")].forEach(elm=>elm.onclick=e=>{e.preventDefault();e.target.style.backgroundColor="#"+(Math.random()*16777216|0).toString(16).padStart(6,'0')})
@TwoSquirrels
TwoSquirrels / bf-minifier.js
Last active September 26, 2022 02:27
Brainf*ck Code Minifier (using Node.js)
#! /usr/bin/env node
// SPDX-License-Identifier: MIT
// (C) 2022 TwoSquirrels
// exports
module.exports = minifyBrainfuck;
// parse command line arguments
const [, thisFilePath, ...args] = process.argv;
if (require.main === module) {