Skip to content

Instantly share code, notes, and snippets.

View preco21's full-sized avatar
☂️
Recovering

Preco Kim preco21

☂️
Recovering
View GitHub Profile
@adtac
adtac / Dockerfile
Last active April 13, 2024 22:33
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@joelnet
joelnet / boolean-expressions-ski.js
Last active August 5, 2019 08:42
Boolean Logic with the SKI Combinators
// S and K are primitive function combinators.
const S = a => b => c => a (c) (b (c))
const K = a => b => a
// Non-primitive combinators can be created with S and K.
const C = S (S (K (S (K (S)) (K))) (S)) (K (K))
const I = S (K) (K)
const KI = K (I)
const M = S (I) (I)
const R = S (K (S (K (S)) (K))) (S (K (S (I))) (K))
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 16, 2024 08:50
set -e, -u, -o, -x pipefail explanation
@noygal
noygal / Windows Subsystem for Linux version 1 and 2 (WSL) - node install guide.md
Last active February 21, 2024 23:17
Installing node via windows subsystem for linux

Windows 10 version 2004 - Installing Node.js on Windows Subsystem for Linux (WSL/WSL2)

UPDATE (Fall 2020): This gist is an updated version to the Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL) guide, I usually just keep here notes, configuration or short guides for personal use, it was nice to know it also helps other ppl, I hope this one too.

Windows updated windows subsystem for linux to version 2, as the F.A.Q stated you can still use WSL version 1 side by side with version 2. I'm not sure about existing WSL machines surviving the upgrade process, but as always backup and 🤞. NOTE: WSL version 1 is not replace/deprecated, and there ar

var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@sintaxi
sintaxi / regions.txt
Last active March 28, 2022 02:12
Surge Regions
List of regions your project is served from when you deploy using surge.
yyz.surge.sh : 159.203.50.177 : CA : Toronto
jfk.surge.sh : 159.203.159.100 : US : New York
sfo.surge.sh : 138.197.235.123 : US : San Francisco
lhr.surge.sh : 46.101.67.123 : GB : London
ams.surge.sh : 188.166.132.94 : NL : Amsterdam
fra.surge.sh : 138.68.112.220 : DE : Frankfurt
sgp.surge.sh : 139.59.195.30 : SG : Singapore
@mpolci
mpolci / dynamic-redux-sagas.md
Last active January 14, 2022 22:05
Helper function creating a dynamic saga for code splitting with redux-saga

Helper function

This function create a saga that runs the sagas in the startingSagas array and takes the actions with type indicated by changeActionType to replace the running sagas. The replacing actions must have a field sagas cointaining the array with the new sagas.

function createDynamicSaga (changeActionType, startingSagas) {
  function* _start (sagas) {
    try {
      yield sagas
@joepie91
joepie91 / random.md
Last active April 10, 2024 18:45
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@Pusnow
Pusnow / 한글과유니코드.md
Last active March 17, 2024 08:27
한글과 유니코드

한글과 유니코드

유니코드에서 한글을 어떻게 다루는지를 정리하였다.

유니코드

  • 유니코드(Unicode)는 전 세계의 모든 문자를 컴퓨터에서 일관되게 표현하고 다룰 수 있도록 설계된 산업 표준 (위키 백과)
  • 단순히 문자마다 번호를 붙임
  • 계속 업데이트되며 현재는 Unicode Version 9.0.0 이 최신이다.

UTF

  • 유니코드를 실제 파일 등에 어떻게 기록할 것인지를 표준화한 것이다.
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example