Skip to content

Instantly share code, notes, and snippets.

const draw = (output) => console.log(output);
const getWeather = async (city) => {
await new Promise((resolve) => setTimeout(resolve, 1000));
return "sunny";
};
const render = async function* ({ city }) {
yield `<Spinner />`;
const weather = await getWeather(city);
return `<Weather info=${weather} />`;
@azu
azu / kagi-to-google.js
Created February 29, 2024 04:10
Surfingkeys shortcut: kagi.com to google
api.mapkey("g", "Kagi to Google", function () {
const isKagi = location.href.startsWith("https://kagi.com/search?");
if (isKagi) {
location.href = `https://www.google.com/search?q=${(new URL(location.href)).searchParams.get("q")}`;
}
});
@azu
azu / README.md
Last active December 27, 2023 00:30
公式ドキュメントのユースケース

Ref なぜ僕は公式ドキュメントを読むのが苦手なのか #初心者 - Qiita

次のようなセクションがあった場合、何を読むかというのはその目的によって異なるという印象。

  • Getting Started: インストール、セットアップ
  • Tutorial: 基本的な使い方(代表的な使い方)
  • Concepts: デザインのコンセプト、なぜ作ったか
  • Examples: 動くサンプル
  • API Reference: APIのリファレンス
@azu
azu / docker failed to register layer: rename.md
Last active March 19, 2024 20:58
Notes on `failed to register layer: rename` error with docker pull.

📝 Docker's "failed to register layer" error on macOS/OrbStack.

Error Message

failed to register layer: rename /var/lib/docker/image/overlay2/layerdb/tmp/write-set-xxx /var/lib/docker/image/overlay2/layerdb/sha256 /<sha>: file exists

Reason

@azu
azu / post-commit
Last active October 14, 2023 07:16
Gitメモ: メモをコミットして作業ツリー自体はメモを書く直前に戻すcommit -hook
# 📝 [Note] Mode -- if commit message starts with "📝" or includes "[Note]"
IS_NOTE_MODE=$(git log -1 --pretty=%B | grep -E '^(📝|\[Note\])')
if [[ -n "${IS_NOTE_MODE}" ]]; then
# メモの作業内容を戻すコミットをする
headSHA=$(git rev-parse HEAD)
git revert --no-commit HEAD
git ls-tree -r --name-only HEAD | xargs git commit -m "↩️ ${headSHA}" --
# メモを書く直前の状態に作業内容を戻す
git revert --no-commit HEAD
# terminal notification
@azu
azu / sql-execute-os-command.md
Last active October 7, 2023 00:42
各SQLサーバでOSコマンドを実行する方法
@azu
azu / Bluesky: auto refresh.user.js
Last active July 27, 2023 09:48
Bluesky: auto refresh
// ==UserScript==
// @name Bluesky: auto refresh
// @namespace https://efcl.info
// @match https://bsky.app/*
// @grant none
// @version 1.0
// @author azu
// @description Auto Refresh when notifications is shown
// ==/UserScript==
const origSetInterval = window.setInterval;
@azu
azu / git auto commit.zsh
Created July 7, 2023 04:49
git auto commit
function git-auto-commit(){
git_status=$(git status --porcelain | grep -vE '^\s')
first=$(echo "$git_status" | head -n1)
filename=$(echo "$first" | awk '{print $NF}')
git_root_dir=$(git rev-parse --show-toplevel)
if echo "$first" | grep -Eq '^\s?M'; then
commit_message="Update $filename"
elif echo "$first" | grep -Eq '^\s?A'; then
commit_message="Add $filename"
elif echo "$first" | grep -Eq '^\s?D'; then
@azu
azu / get-new-ribbon.sh
Created May 28, 2023 01:21
Replace old GitHub ribbon image to new GitHub ribbon image. Old GitHub ribbon image is deleted at 2023-05
rg "https://s3.amazonaws.com/github/ribbons/" --files-with-matches -0 | xargs -0 sed -i '' 's/https:\/\/s3.amazonaws.com\/github\/ribbons\//https:\/\/github.blog\/wp-content\/uploads\/2008\/12\//g'