# Cargo binstall
# https://github.com/cargo-bins/cargo-binstall?tab=readme-ov-file#telemetry-collection
export BINSTALL_DISABLE_TELEMETRY=true
# Go Telemetry (not opt-in by default)
# https://go.dev/doc/telemetry
export GOTELEMETRY=off
# GatsbyJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function encode(value) { | |
const long = BigInt(value); | |
const result = []; | |
let shift = 0n; | |
while (true) { | |
const number = Number(BigInt.asUintN(7, long >> shift)); | |
if (number) { | |
result.push(number); | |
shift += 7n; |
보건의료빅데이터개방시스템(opendata.hira.or.kr) 공공데이터 상세 페이지 첨부파일 일괄 다운로드 스크립트
bun install
PAGE="https://opendata.hira.or.kr/op/opc/selectOpenData.do?sno=11925&publDataTpCd=&searchCnd=&searchWrd=%EC%A0%84%EA%B5%AD&pageIndex=1"
bun download-hira.ts "$PAGE"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as http from 'node:http'; | |
import { Readable } from 'node:stream'; | |
import { setInterval } from 'node:timers/promises'; | |
async function* chunksWhile(ms) { | |
let count = 0; | |
for await (const startTime of setInterval(1000, Date.now())) { | |
yield `<div>Looking for your cat... (n=${++count})</div>`; | |
if (Date.now() - startTime > ms) { | |
return; |
There are too many LRU(Least Recently Used) implementations in JS.
I recommend to use [flru] which is the smallest one and fast enough. Unless you need more rich functionality.
However, it's performance is vary depend on the host environment. For example, flru loses on Bun.
If you need micro-optimization on it, measure it yourself in your environment.
- Design format as a compact binary representation of the GraphQL trusted documents
- The decoder should interface as a ReadableStream
- It aligns the execution order of resolvers ahead-of-time
- Pipe-able
execute
which compatible with exsting GraphQL resolvers- It should support e.g
unpack(docs).pipe(executeStream)
- It should support e.g
- Implement stream acceptance from the client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function healthcheck() { | |
local domain=$1 | |
local total_tests=$2 | |
local total_failed_count=0 | |
local ip_list=() | |
for ((i = 0; i < total_tests; i++)); do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { parseArgs } from 'node:util'; | |
import { spawn } from 'node:child_process'; | |
import { setTimeout } from 'node:timers/promises'; | |
import prettyBytes from 'pretty-bytes'; | |
import prettyMilliseconds from 'pretty-ms'; | |
let { values, positionals } = parseArgs({ | |
args: process.argv.slice(2), | |
allowPositionals: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import * as fs from 'node:fs'; | |
import csvParser from 'csv-parser'; | |
const [csvFile, sku] = process.argv.slice(2); | |
if (!fs.existsSync(csvFile) || !sku) { | |
console.error('Usage: ./report.mjs [CSV file] [SKU]'); | |
process.exit(1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nextProgress = (progress: number) => { | |
switch (true) { | |
case progress < 40: { | |
return progress + 40 + Math.random() * 10; | |
} | |
case progress < 60: { | |
return progress + 8 + Math.random() * 2; | |
} | |
case progress < 80: { | |
return progress + 3 + Math.random() * 2; |
NewerOlder