HNHacker News
TopNewBestAskShowJobs

kerneloops

164 karma · joined January 4, 2022

submissionscomments
kerneloops··on Unconventional Ways to Cast in TypeScript
Another one:

  const cast: <A, B> (a: A) => B = function <B> (): B {
    return arguments[0]
  }
  const n: string = cast(1)
kerneloops··on Tonal.js: Functional music theory lib
See also: Well-typed music does not sound wrong (experience report), Haskell 2017

https://dl.acm.org/doi/10.1145/3122955.3122964

kerneloops··on Tell HN: Python's print function is thread-unsafe
A survey of some other languages:

C printf: MT-Safe locale.

C++ std::cout: safe, unless you call sync_with_stdio(false).

JVM System.out.println: safe in common JVMs.

C# Console.WriteLine: safe.

Go fmt.Printf: safe.

Rust println!: safe.

Ruby puts: safe.

So it seems that Python is the outlier here.

kerneloops··on Joplin – An open-source note taking and to-do application with synchronisation
The only problem to me is that the "official" Joplin Server is proprietary: https://github.com/laurent22/joplin/blob/dev/packages/server...
kerneloops··on An Introduction to Oblivious RAM (2020)
URL should be https://research.kudelskisecurity.com/2020/04/22/an-introduc...
kerneloops··on Reverse Engineering TikTok's VM Obfuscation (Part 2)
> Using these accessors, the VMs become able to do anything that JS can do.

In fact the source language is likely to be JS itself; a JS-to-some-sort-of-vm-bytecode-to-JS compiler is made. I know that Tencent has a similar VM; an interesting aspect of that VM is that the instruction set is dependent on the code being compiled (and the opcodes are dynamically generated and shuffled when compiling), so unused instructions are not generated.

kerneloops··on Reverse Engineering TikTok's VM Obfuscation
Another reason to use `void 0` is that "void 0" takes only 6 characters while "undefined" takes 9, saving some bandwidth. It is common practice for JavaScript minifiers to use this substitution.
kerneloops··on Samsung Recent Security Incident
I usually give them 1970/1/1 as my birthday. That's easier to remember, since password managers don't work well with date inputs sometimes.
kerneloops··on Falsehoods programmers believe about email
Microsoft (at least used to) require account passwords to not include the part before @ in email addresses. My email address was a@(domain).net, and therefore I was prevented from using any password including the letter "a".
kerneloops··on How can you be fooled by the U+202E trick? (2013)
The character 囍 means "double happiness" literally, and is often used in wedding ceremonies among other places here in China. It is also included in the Xinhua dictionary, the semi-official dictionary in mainland China.
kerneloops··on The joy of building a ray tracer, for fun, in Rust
It's also a undergrad course lab here at SJTU, also in Rust: https://github.com/aik2mlj/raytracer-tutorial