Skip to content

Instantly share code, notes, and snippets.

@miy4
miy4 / prep-python.py
Last active November 25, 2024 15:46
Add extra configuration to a new Python project
#!/usr/bin/env python
import sys
from pathlib import Path
if not Path("pyproject.toml").exists():
print(
"Ensure you did:\n uv init --app --package\n or uv init --app",
file=sys.stderr,
)
@miy4
miy4 / prep-deno.py
Last active November 25, 2024 15:48
Add extra configuration to a new Deno project
#!/usr/bin/env python
import sys
from pathlib import Path
archives = [
{
"name": ".vscode/settings.json",
"data": """
{
@miy4
miy4 / dropper.ts
Last active November 23, 2024 09:15
HTML to Markdown: @mozilla/readability + pandoc
#!/usr/bin/env -S deno run -A --ext ts
import $ from "jsr:@david/[email protected]";
import { parseArgs } from "node:util";
import { Readability } from "npm:@mozilla/[email protected]";
import { JSDOM } from "npm:[email protected]";
const { code } = await $`/bin/which pandoc`.noThrow().quiet();
if (code !== 0) {
console.error("Command not found: pandoc\nPlease install pandoc first.");
Deno.exit(1);
@miy4
miy4 / pick-emoji.ts
Last active November 25, 2024 16:00
Ask gemini-flash-1.5 to find the perfect emoji
#!/usr/bin/env -S deno run -A --ext ts
import { google } from "npm:@ai-sdk/[email protected]";
import { generateText } from "npm:[email protected]";
import { parseArgs } from "node:util";
const arg = parseArgs({
args: Deno.args,
allowPositionals: true,
options: {},
});
@miy4
miy4 / trej.ts
Last active October 13, 2024 06:50
Ask gemini-1.5-flash to translate between Japanese and English, and vice versa
#!/usr/bin/env -S deno run -A --ext ts
import { google } from "npm:@ai-sdk/[email protected]";
import { generateText } from "npm:[email protected]";
import { parseArgs } from "node:util";
const arg = parseArgs({
args: Deno.args,
allowPositionals: true,
options: {},
});
@miy4
miy4 / メトロイドプライムリマスタード.md
Created August 12, 2024 15:43
メトロイドプライム リマスタード 100% ガイド
@miy4
miy4 / botw-en-ja.tsv
Last active June 19, 2023 09:34
ゼルダの伝説 ブレス オブ ザ ワイルド 英日対訳表
??? 不思議な声
Acorn どんぐり
Agus パラガス
Aji アジテータ
Akrah オラク
Album アルバム
Aliza イライザ
Amali ハミラ
Amber コハク
Amber Earrings コハクの耳飾り
@miy4
miy4 / print_distro_logo.bash
Created December 22, 2022 00:57
Print a list of distro logos by neofetch
#!/bin/bash
source /usr/bin/neofetch 2>&1 >/dev/null
typeset -f get_distro_ascii | \
grep -E '^\s+".*)$' | \
grep -oP '".*?"' | \
while read -r line; do
printf '%s\n' "$line"
neofetch -L --ascii_distro "${line:1:-1}"
done
@miy4
miy4 / print-unicode-codepoint.bash
Created November 16, 2021 01:52
Print Unicode codepoint in Bash
#!/bin/bash
# http://mywiki.wooledge.org/BashFAQ/071
# > If the leading character is a single-quote or double-quote,
# > the value shall be the numeric value in the underlying codeset
# > of the character following the single-quote or double-quote.
printf 'U+%04x\n' "'a"
printf 'U+%04x\n' "'あ"
@miy4
miy4 / bash-join-elements.bash
Created November 16, 2021 01:23
Joining elements of an array in Bash
#!/bin/bash
fruits=('apple' 'orange' 'banana')
printf '%s\n' "${fruits[*]}"