Skip to content

Instantly share code, notes, and snippets.

View cometkim's full-sized avatar

Hyeseong Kim cometkim

View GitHub Profile
@motorailgun
motorailgun / idea.md
Last active April 11, 2025 11:36
Installing Windows and Linux into the same partition

Installing Windows and Linux into the same partition

But WHY?

There was a reddit post about installing Arch on NTFS3 partition. Since Windows and Linux doesn't have directories with same names under the /(C:\), I thought it's possible, and turned out it was actually possible.
If you are not familiar to Linux, for example you've searched on Google "how to dualboot Linux and Windos" or brbrbr... you mustn't try this. This is not practical.

Pre-requirements

  • UEFI system
  • Any Linux live-boot CD/DVD/USB... with Linux kernel newer than 5.15
  • Windows installer USB

A Runtime ImportMap Example - now as a module

While it's not possible to define a <script type="importmap"> within a module, it is possible to define it in a synchronous <script> tag, as long as it's before any module starts executing.

Example (works in Chrome / Edge / WebKit / Safari / Firefox)

<!DOCTYPE html>
<html lang="en">
<head>
const std = @import("std");
// usage:
// ./file-path:0 10
// 1 2 3
// 1. file path
// 2. Byte offset in file
// 3. ms update interval
pub fn main() anyerror!void {
@mjpitz
mjpitz / _README.md
Last active August 1, 2024 21:43
comparison of embedded databases for raft

As an exercise, I started to design and implement a database in some of my free time. As I started working through some of the details, there were a few things that I knew I wanted to work with and a few things I wanted to evaluate. Since I'm looking at more of a CP system, my mind immediately jumped to Raft. But which implemenation to use? And what storage mechanism? Since I had more familiarity with Hashicorps implemenation, I started there.

The first thing I wanted to do was consider the performance characteristics of the underlying data stores. One of the nice features of the hashicorp implementation is it allows callers to plugin in different stores for logs, stable, and snapshots. There's a whole slew of community implementations.

@giuliano-macedo
giuliano-macedo / download_file.rs
Last active October 25, 2024 17:13
Download large files in rust with progress bar using reqwest, future_util and indicatif
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
@chaance
chaance / test.ts
Created April 7, 2021 21:03
Focusing in tests is frustrating
describe("when navigating between focused buttons", () => {
let buttons: HTMLElement[];
beforeAll(() => {
let rendered = renderTestAccordion();
buttons = rendered.buttons;
});
it("should move focus to the next focusable button on `ArrowDown` press", () => {
// document.activeElement is the body here, cool
buttons[0].focus();
@jamiebuilds
jamiebuilds / tradeoffs-in-value-derived-types-in-typescript.md
Last active December 16, 2022 17:21
Value-derived types in TypeScript are super powerful, but you should be thoughtful in how/when you use them

Tradeoffs in value-derived types in TypeScript

Many of the more "advanced" typescript features can be used for creating "value-derived" types.

At its simplest form:

let vehicle = { name: "Van", wheels: 4 }
@steveruizok
steveruizok / point-to-line.ts
Last active March 23, 2021 06:08
Get the minimum distance between a point and a line. Get the nearest point on a line to a second point.
/**
* Get the minimum distance from a point P to a line with a segment AB.
* @param A The start of the line.
* @param B The end of the line.
* @param P A point.
* @returns
*/
export function distanceToLine(A: number[], B: number[], P: number[]) {
const delta = sub(B, A)
const angle = Math.atan2(delta[1], delta[0])
@ggoodman
ggoodman / README.md
Created February 25, 2021 15:14
Using the concept of defer from golang to simplify resource cleanup in Javascript

The withCleanup helper

Example

const result = await withCleanup(async (defer) => {
  const fileHandle = await getFileHandle();
  defer(() => fileHandle.close());
   
 // Carry on