Skip to content

Instantly share code, notes, and snippets.

@hi-ogawa
hi-ogawa / hangle-syllables.js
Last active February 28, 2023 10:39
List hangul syllables
/*
$ node hangle-syllables.js
가 :
각 :
갂 :
갃 :
간 :
갅 :
갆 :
@hi-ogawa
hi-ogawa / bin-gist.sh
Last active December 26, 2022 07:46
download shell script from gist and install it locally
#!/bin/bash
set -eu -o pipefail
#
# something similar to https://github.com/marcosnils/bin but for simple shell scripts on gist
#
# usage:
# bash bin-gist.sh https://gist.github.com/hi-ogawa/1e0b1a147e883aad41f97c68246f3c33 bin-gist.sh
# bash bin-gist.sh https://gist.github.com/hi-ogawa/bca49e90241f7808127a430f986d33ea passphrase.sh
#
@hi-ogawa
hi-ogawa / passphrase.sh
Last active September 12, 2023 23:39
passphrase generator
#!/bin/bash
set -eu
#
# usage:
# $ bash passphrase.sh
# amusement-twelve-pusher-gilled-excuse
#
# references
@hi-ogawa
hi-ogawa / playwirhgt-for-scraping.ts
Last active December 14, 2022 06:31
playwright for scraping
import { chromium, Page } from "playwright-chromium";
import process from "node:process";
// this specific example is made to extract the list of spot trade coins on ByBit
// usage:
// node -r esbuild-register playwirhgt-for-scraping.ts --headed
// note:
// "page.pause" with "--headed" allows the same debugging experience as playwright testing.
@hi-ogawa
hi-ogawa / PKGBUILD
Created November 21, 2022 00:14
PKGBUILD aws-cli-v2-bin
# it seems aws-cli-v2-bin is deleted from aur. I extracted PKGBUILD from yay cache just in case.
# Maintainer: Steve Engledow <[email protected]>
pkgname=aws-cli-v2-bin
pkgver=2.8.3
pkgrel=1
pkgdesc='Universal Command Line Interface for Amazon Web Services version 2'
arch=('aarch64' 'x86_64')
url='https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html'
license=('Apache')
@hi-ogawa
hi-ogawa / patch-transaction-editable.ts
Last active November 15, 2022 04:28
jscodeshift script for converting number values to string values within specified forms of variable declarations
/* eslint-disable no-console */
//
// usage:
// npm i -D jscodeshift @types/jscodeshift recast
// npx jscodeshift --parser tsx --transform patch-transaction-editable.ts (...files)
//
/*
//// example input ////
@hi-ogawa
hi-ogawa / use-debounced-function.ts
Last active November 14, 2022 07:10
use-debounced-function.ts
//
// example:
// <button onClick={useDebouncedFunction(() => console.log("debounced?"), 500)} />
//
export function useDebouncedFunction<T extends (...args: any[]) => void>(
original: T,
ms: number
): (...args: Parameters<T>) => void {
const [call, setCall] = React.useState<() => void>();
@hi-ogawa
hi-ogawa / README.md
Last active December 11, 2022 07:50
Extract css variables from less variables
@hi-ogawa
hi-ogawa / eas-cli+2.6.0.patch
Created October 31, 2022 08:13
patch-package eas-cli to test "eas build --local" without expo account
diff --git a/node_modules/eas-cli/build/commandUtils/context/DynamicProjectConfigContextField.js b/node_modules/eas-cli/build/commandUtils/context/DynamicProjectConfigContextField.js
index f59d57f..5c68793 100644
--- a/node_modules/eas-cli/build/commandUtils/context/DynamicProjectConfigContextField.js
+++ b/node_modules/eas-cli/build/commandUtils/context/DynamicProjectConfigContextField.js
@@ -11,6 +11,11 @@ class DynamicProjectConfigContextField extends ContextField_1.default {
return async (options) => {
const projectDir = await (0, findProjectDirAndVerifyProjectSetupAsync_1.findProjectDirAndVerifyProjectSetupAsync)();
const expBefore = (0, expoConfig_1.getExpoConfig)(projectDir, options);
+ return {
+ exp: expBefore,
@hi-ogawa
hi-ogawa / README.md
Last active October 27, 2022 03:07
replace star import with default import

to help migrating a code base when enabling esModuleInterop (https://www.typescriptlang.org/tsconfig#esModuleInterop)

# import * as path from "path"
#
# import path from "path"

git grep -z -l 'import \* as' | xargs -0 perl -pi -e 's/import \* as /import /g'

# only simple module name (e.g. "some-module" but not "./some-file")