Skip to content

Instantly share code, notes, and snippets.

View lacti's full-sized avatar

Jaeyoung, Choi lacti

View GitHub Profile
@lacti
lacti / korean-subway-station-list.json5
Created February 14, 2025 15:40 — forked from nemorize/korean-subway-station-list.json5
대한민국 국내에 존재하는 지하철역 정보(역명, 지역구, 노선, 위/경도) 목록
[
// =======================================================
// 모든 정보는 직접 수집하여 정리한 정보입니다.
// 일부 정보가 오기되었거나, 위/경도 좌표가 부정확할 수 있으므로 유의하세요.
// =======================================================
{
'name': '가양역',
'city': '서울',
'areas': [ '강서구' ],
'lines': [ '9호선' ],
const { parse } = require("csv-parse/sync");
const fs = require("fs");
const path = require("path");
const rows = parse(
fs.readFileSync("./LSS-Chat_Integration_Testcases_20230222.csv", "utf-8"),
{ bom: true, columns: false, skip_empty_lines: true }
);
const tuples = rows
.filter((_, index) => index >= 1)
@lacti
lacti / http-agent.js
Last active December 20, 2022 08:07
Simple command runner via HTTP API call
const http = require("http");
const url = require("url");
const { exec } = require("child_process");
const port = +(process.env.PORT ?? "5000");
const host = process.env.HOST ?? "127.0.0.1";
const secret = process.env.SECRET;
const command = process.env.COMMAND;
if (!secret) {
@lacti
lacti / Program.cs
Last active December 17, 2022 06:02
C# WebSocket Session Client
using System;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace YYT28 {
class Program
{
@lacti
lacti / _local-ssl
Created July 8, 2022 00:21
How to setup local SSL
# How to setup local SSL
#!/bin/bash
# https://askubuntu.com/a/1360291
set -euxo pipefail
dmesg | grep iwl
echo "Continue? "; read
LIB_FIRMWARE="/lib/firmware"
IWLWIFI_TARGET="iwlwifi-ty-a0-gf-a0.pnvm"
@lacti
lacti / hello-api-autocannon.log
Created April 16, 2021 08:07
Hello API autocannon log to check between cold start latency and concurrency.
[Thu Apr 15 15:09:23 UTC 2021] Sleep 720 seconds
[Thu Apr 15 15:21:23 UTC 2021] Start connection=1
Running 60s test @ https://API_HOST/hello?name=lacti
1 connections
┌─────────┬───────┬───────┬───────┬───────┬──────────┬─────────┬────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼───────┼───────┼───────┼───────┼──────────┼─────────┼────────┤
│ Latency │ 13 ms │ 16 ms │ 25 ms │ 31 ms │ 16.56 ms │ 6.72 ms │ 356 ms │
└─────────┴───────┴───────┴───────┴───────┴──────────┴─────────┴────────┘
@lacti
lacti / httpGet.ts
Created February 9, 2020 01:19
Simple example to request HTTP/s without node-fetch
import getStream from "get-stream";
import * as http from "http";
import httpRequest from './httpRequest';
export default function httpGet(
url: string,
requestArgs: http.ClientRequestArgs
) {
return httpRequest(url, requestArgs).then(res => getStream(res.setEncoding("utf-8")));
}
@lacti
lacti / webpack.replace-code.plugin.ts
Created December 31, 2019 09:18
A simple example for webpack plugin to replace source code.
import webpack from "webpack";
const isMatch = (includes: RegExp[], input: string) =>
input && includes.some(regex => regex.test(input));
const replaceAll = (
patterns: Array<{ regex: RegExp; value: string }>,
input: string
) =>
patterns.reduce(
@lacti
lacti / index.js
Last active September 16, 2019 14:23
The `readline.close` magic from NodeJS + Windows
const readline = require("readline");
// This promise cannot be resolved with high probability if a millis is bigger than 1.
const next = () => new Promise(fulfill => setTimeout(fulfill, 2 /* MAGIC */));
const rl = new readline.createInterface({
input: process.stdin,
output: process.stdout,
// But everything is ok if you set `terminal` to `false.
// terminal: false,