Skip to content

Instantly share code, notes, and snippets.

@hi-ogawa
hi-ogawa / youtube-thumbnail.js
Created January 25, 2025 07:22
A little script I used to fix up thumbnails of old videos
/*
Fix up old thumbnails https://www.youtube.com/@hiroshi18181/videos
- dump all videos data
yt-dlp -j https://www.youtube.com/@hiroshi18181/videos > videos.ndjson
jq -s '[.[] | {id, title, description}]' videos.ndjson > videos-slim.json
node youtube-thumbnail.js process-json videos-slim.json > videos-slim2.json5
@hi-ogawa
hi-ogawa / README.md
Last active January 6, 2025 06:49
Recording workflow (wip)

I started to upload bass covers on https://www.youtube.com/@hiroshi18181. Writing my current workflow and some plans to explore and improve.

softwares

  • audacity
  • ardour
  • kdenlive
  • youtube

hardwares

@hi-ogawa
hi-ogawa / README.md
Created October 23, 2024 06:56
Delete ghost notification
@hi-ogawa
hi-ogawa / main.js
Last active October 17, 2024 09:06
generate a link to evanw's source-map-visualization
// https://github.com/oxc-project/oxc/blob/a6487482bc053797f7f1a42f5793fafbd9a47114/crates/oxc_codegen/examples/sourcemap.rs#L34-L44
function generate(code, mapJson) {
const hashRaw = `${code.length}\0${code}${mapJson.length}\0${mapJson}`;
// const hash = btoa(hashRaw);
const hash = Buffer.from(hashRaw, "utf-8").toString("base64");
return `https://evanw.github.io/source-map-visualization/#` + hash;
}
console.log(generate(result.code, JSON.stringify(result.map)))
@hi-ogawa
hi-ogawa / wrapConsoleTimeAsync.ts
Created November 28, 2023 08:27
wrapConsoleTimeAsync.ts
function wrapConsoleTimeAsync<F extends (...args: any[]) => any>(f: F) {
const wrapper = async function (this: any, ...args: any[]) {
const id = Math.random().toString(36).slice(2).padStart(12, "0");
const label = `${f.name}:${id}`;
globalThis.console.time(label);
try {
return await f.apply(this, args);
} finally {
globalThis.console.timeEnd(label);
}
@hi-ogawa
hi-ogawa / README.md
Last active November 14, 2023 04:23
remix development tips
@hi-ogawa
hi-ogawa / intl-extract.ts
Created August 22, 2023 06:57
intl-extract.ts by jscodeshift
/* eslint-disable no-console */
import type { API, FileInfo } from "jscodeshift";
import * as recast from "recast";
export default function transformer(file: FileInfo, api: API): string | undefined {
const j = api.jscodeshift;
const $j = j(file.source);
const result: {
@hi-ogawa
hi-ogawa / README.md
Last active June 14, 2023 00:18
worker with javascript data url
@hi-ogawa
hi-ogawa / README.md
Last active May 30, 2023 05:16
follow up after github squash merge

scenario

  • y: main
  • z: PR-1
  • w: PR-2 (based on PR-1)
x - y
  \ 
 z - w
@hi-ogawa
hi-ogawa / createReactQueryOptionsProxy.ts
Last active May 20, 2023 07:36
createReactQueryOptionsProxy.ts
//
// generate type-safe react-query options wrapper from a record of async functions
//
type FnRecord = Record<string, (input: unknown) => unknown>;
type FnInput<F extends (input: unknown) => unknown> = Parameters<F>[0];
type FnOutput<F extends (input: unknown) => unknown> = Awaited<ReturnType<F>>;
type ReactQueryOptionsProxy<T extends FnRecord> = {
[K in keyof T]: {