Skip to content

Instantly share code, notes, and snippets.

@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) => {
@azu
azu / @dependabot merge.js
Last active January 4, 2023 15:33
Google Apps Script: auto reply `@dependabot merge`
// MIT LICENSE ©️ azu
// Usage:
// 1. Create `MERGE_REPLY_LABEL`
// 2. Upload GAS
// 3. Update CONFIG
// 4. Execute `createTimeTrigger` function on GAS
// === CONFIG ====
// Interval hours
const FETCH_INTERVAL_HOURS = 12;
const YOUR_MAIL_ADDRESS = "{yourmail}@gmail.com"
@azu
azu / notion-daily-generator.mjs
Created January 1, 2023 06:36
notion-daily-generator.mjs
import { Client } from "@notionhq/client"
import dayjs from "dayjs"
const notion = new Client({
auth: process.env.NOTION_API_TOKEN,
});
/**
*
* @param {title} title
@azu
azu / ublacklist-best-of.txt
Created December 30, 2022 23:45
ublacklist: best of N
*://ranking.goo.ne.jp/*
*://my-best.com/*
*://sakidori.co/*
*://wowma.jp/*
*://osusume.mynavi.jp/*
*://pc.moppy.jp/*
*://heim.jp/*
*://www.esquire.com/*
*://epark.jp/*
*://iecolle.com/*
@azu
azu / input.user.js
Created November 23, 2022 05:58
get input text
// ==UserScript==
// @name Visual Textarea
// @namespace textarea
// @include http://*
// @include https://*
// @grant none
// @version 1.0
// @author -
// @description 2022/11/23 14:19:51
// ==/UserScript==