Instantly share code, notes, and snippets.

View special-number-36.md

I just turned age 36 (by Korean standards) and noticed that some of my friends seem to be sad to have such a "big" number as their age.

So I thought about whether there could be anything special about the number 36 and I found a simple and interesting pattern for that number.

When you divide 36 by 2, the answer is 18 (36 / 2 == 18); and when you multiply each digit of 36 individually, the answer is also 18 (3 * 6 == 18)!

So it seemed kind of special to me and then I wondered if there is any natural number that has these same features (except 0)

As a non-math person, the shocking discovery was that 36 seems to be the only number under 10M.

View IDEA.md

prctl - Probe and Resource ConTroL (for k8s)

Just an Gist idea for now

Why?

  • It's mundane to edit every Deployment in your k8s cluster to have your desired state for Liveness/Readiness Probe and Resources for each container
  • Manaul operations also don't help collaborations of discussions to have right values for the states

How this would be better than manual approach?

  • One(ish) place to read and edit desired states
  • Keep alerting if the state of the container is different than the repository linked
View FastPipeIssue.re
/* this works */
"1=2=3"
|> Js.String.split("=")
|. Js.log;
/* this works, too */
"1=2=3"
-> Js.log;
/* but the code below doesn't */
View READEME.md

Claim: Difficulty with interop with JS when accepting nested object param from JS to Reason

Reasonml Ver: 3.3.2

  • No problem with taking parameters from JS and matching to any type contains optional with one depth

  • But it seems to lose values wrapped by option if you have more depth like below

View rainist_holdem_heechul.py
from typing import List
from random import randint
from .core.cards import Card
from .player import Me, Other
def bet(
me: Me,
bet_players: List[Other],
View Reason-Option-Iterop-Issue.md

I wanted to make an npm module via ReasonML

  • a function need to accept objects
  • but couldn't find a way to convert an JS Object to a Reason Record (holds optional value)
// I wanted to have an npm module function like below
reasonFnExposedToJs({key1: 'blah', key2: undefined})

// and works fine with Reason side but generated argsFromJs looks like below
View ttl.jsx
const ttl = (strings, ...variables) => [strings, ...variables]
// or const ttl = (...args) => [...args]
// we are using www.styled-components.com as an example
const Adder = ({className, x, y}) => {
return (
<span className={className}> {x+y} </span>
)
}
View no-concurrency-promise.js
function printTo100(n) {
for (i in [...Array(100).keys()]){
console.log(`${n}-${i}`)
}
return Promise.resolve()
}
Promise.all(
printTo100('a'),
printTo100('b'),
View useful-commands.sh
# find a process using port 3000 via https://unix.stackexchange.com/a/106562
sudo lsof -n -i :3000 | grep LISTEN
# export env vars from a file via https://github.com/sunghyunzz
export $(cat .env | xargs)
# check the reachability of the website every 1 seconds
while true; do curl -I https://example.com/; sleep 1; done
# pipe stdout as one arg to another command