Skip to content

Instantly share code, notes, and snippets.

@azu
azu / Bluesky: auto refresh.user.js
Last active May 4, 2025 18:35
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'
@azu
azu / README.md
Last active March 24, 2023 13:16
Alternative ni written in Zsh
@azu
azu / gh-issue-checkout.zsh
Created January 20, 2023 11:35
search GitHub Isssue and checkout for develop
function gh-issue-checkout(){
INITIAL_QUERY="$1"
GH_ISSUE_LIST="gh issue list -S"
FZF_DEFAULT_COMMAND="$GH_ISSUE_LIST '$INITIAL_QUERY'" \
gh issue list | \
fzf --layout=reverse \
--bind "change:reload:$GH_ISSUE_LIST {q} || true,ctrl-o:execute(echo {} | xargs gh issue view --web)+abort"\
--preview "gh issue view {1} | bat --color=always --style=grid --file-name O.md" \
--header 'Press Ctrl+O to open issue' \
| awk '{print $1}' | xargs -IXXX gh issue develop XXX --name "feature/XXX" --checkout
@azu
azu / z.zsh
Created January 19, 2023 08:04
zoxide + fzf + bat + exa
# https://github.com/ajeetdsouza/zoxide
export _ZO_FZF_OPTS='
--no-sort --height 75% --reverse --margin=0,1 --exit-0 --select-1
--bind ctrl-f:page-down,ctrl-b:page-up
--bind pgdn:preview-page-down,pgup:preview-page-up
--prompt="❯ "
--color bg+:#262626,fg+:#dadada,hl:#f09479,hl+:#f09479
--color border:#303030,info:#cfcfb0,header:#80a0ff,spinner:#36c692
--color prompt:#87afff,pointer:#ff5189,marker:#f09479
--preview "([[ -e '{2..}/README.md' ]] && bat --color=always --style=numbers --line-range=:50 '{2..}/README.md') || exa --color=always --group-directories-first --oneline {2..}"
@azu
azu / GitHub Issue: Open VSCode.user.js
Last active January 16, 2023 05:57
Greasemonkey: Open GitHub Issue in VSCode
// ==UserScript==
// @name GitHub Issue: Open VSCode
// @namespace info.efcl.open-vscode-
// @match https://github.com/*/*/issues/*
// @match https://github.com/*/*/pull/*
// @grant GM_download
// @grant GM_openInTab
// @grant GM_registerMenuCommand
// @version 1.0
// @author azu
@azu
azu / README.md
Last active January 16, 2023 14:46
Migration Script: Convert TypeScript project to Node.js dual package

Convert TypeScript library project to Node.js Dual Package

It is a script to convert a TypeScript library project to a Node.js Dual CommonJS/ES module packages.

This script aim to convert following project:

  • Use TypeScript
  • Use ts-node
  • Use mocha
@azu
azu / all-env-circleci.mjs
Last active January 6, 2023 06:28
Get Circle CI Project envars! Require Node.js 16 + `npm install node-fetch`
import fetch from "node-fetch"; // Node.js 18 just remove line
const CIRCLECI_TOKEN = process.env.CIRCLECI_TOKEN
const ORG_NAME = process.env.ORG_NAME
const fetchProjectList = (orgName = ORG_NAME) => {
return fetch(`https://circleci.com/api/v2/insights/gh/${orgName}/summary`, {
headers: { "Circle-Token": `${CIRCLECI_TOKEN}` }
}).then(res => res.json()).then(json => json.all_projects);
};
const fetchProjectEnv = (orgName, project) => {