Skip to content

Instantly share code, notes, and snippets.

View hyunbinseo's full-sized avatar

Hyunbin Seo hyunbinseo

  • 다양한학습자를위한 주식회사
  • Republic of Korea
  • 11:23 (UTC +09:00)
  • LinkedIn in/hyunbinseo
View GitHub Profile
@hyunbinseo
hyunbinseo / drizzle-pick-table-columns.ts
Last active September 22, 2024 07:33
Pick Drizzle ORM columns from a table with type safety
import { getTableColumns, type Table } from 'drizzle-orm';
import { integer, sqliteTable } from 'drizzle-orm/sqlite-core';
import { db } from './client.js';
export const pickTableColumns = <
T extends Table, //
const ColumnName extends keyof T['_']['columns']
>(
table: T,
columnNames: ColumnName[]
@hyunbinseo
hyunbinseo / CHECKLIST.md
Created August 18, 2024 02:15
Multi-line checklist item in GitHub flavored markdown
  • Single-line item
  • Multi-line item
    Multi-line item
    Multi-line item
  • This item is still clickable
@hyunbinseo
hyunbinseo / $SvelteKit.md
Created August 8, 2024 07:31
Block form double submit in SvelteKit use:enhance
@hyunbinseo
hyunbinseo / README.md
Created June 4, 2024 15:40
Setup fnm on Windows with corepack

PowerShell must be used. Windows Terminal is advised.

winget install Schniz.fnm

Create a PowerShell profile if it does not exist. Reference

if (!(Test-Path -Path $PROFILE)) {
@hyunbinseo
hyunbinseo / D3.svelte
Created March 13, 2024 15:43
D3 in vanilla Svelte
<!-- https://d3js.org/getting-started#d3-in-vanilla-html -->
<script lang="ts">
import * as d3 from 'd3';
import type { Action } from 'svelte/action';
const width = 640;
const height = 400;
const marginTop = 20;
const marginRight = 20;
@hyunbinseo
hyunbinseo / pw_auth.bash
Created March 9, 2024 15:08
Disable password authentication in Ubuntu 22.04 (Vultr instance)
cd /etc/ssh
sudo nano sshd_config
# PasswordAuthentication no
# Remove the leading pound sign
cd sshd_config.d
ls # 50-cloud-init.conf
sudo nano 50-cloud-init.conf
@hyunbinseo
hyunbinseo / cloudflare.tsv
Last active March 4, 2024 03:34
Cloudflare Colocations in Korea
구분 통신사 지역
5G KT LAX
5G KT LAX
5G KT LAX
5G KT LAX
5G LGU HKG
5G LGU ICN
5G SKT KIX
5G SKT KIX
5G SKT LAX
@hyunbinseo
hyunbinseo / js.svelte
Created January 9, 2024 06:05
Svelte Syntax Highlighting
<script>
$: if (browser && data) {
chart.ref?.updateSeries(data.series);
}
</script>
<p>Hello, World</p>
@hyunbinseo
hyunbinseo / index.js
Last active November 3, 2023 05:14
SMS API Speed Comparison
// Create .env file and add secret values.
// Run with node --env-file=.env index.mjs
// Requires Node.js 20+ (LTS as of 2023-10-24)
const {
NHN_SMS_APP_KEY,
NHN_SMS_SECRET,
NHN_SMS_SEND_NO,
SEND_TO,
TWILIO_ACCOUNT_SID,
@hyunbinseo
hyunbinseo / index.ts
Created June 24, 2023 12:09
Drizzle ORM Cheat Sheet
import { asc, eq, gte, lte } from 'drizzle-orm';
import { drizzle } from 'drizzle-orm/mysql2';
import { createPool } from 'mysql2';
import * as schema from './schema';
import { comments, users } from './schema';
const connection = createPool({
host: '...',
user: '...',
password: '...',