HNHacker News
TopNewBestAskShowJobs

gyf304

453 karma · joined December 30, 2020

submissionscomments
gyf304··on Getting arrested in Japan
That’s a thing as well in some US states called duty to retreat.
gyf304··on Show HN: FFmpeg Pages – because I was tired of fighting FFmpeg
Look great, a few nits:

- For the convert page, the tool seems to conflate codec and container format. For example, for MKV option, the tool specifies libx264, when MKV is capable of many more codecs. In addition, a lot of the times when people want to "convert", e.g. from MP4 to MKV, they mean to remux - i.e. "-c copy", which doesn't seem like an option here.

- For the compress page, the tool allows you to specify the target size, however the command output limits bitrate instead of target size. This means that the output size will vary depending on how long the input is, and will almost never be the specified target size.

I would suggest merge the "Convert" and "Compress" tabs, and allow specifying:

- video bitrate (-b:v)

- video codec (-c:v)

- audio bitrate (-b:a)

- audio codec (-c:a)

- container format

I found handbrake to be a good GUI-based alternative if ffmpeg commands are overwhelming.

gyf304··on Show HN: I made a 3D SVG Renderer that projects textures without rasterization
It’s worth noting that this same restriction of not being able to do perspective transformations is also one of the defining characteristics of PlayStation 1 graphics. And the workaround of subdivision is also the same workaround PS1 games used.

More reading: https://retrocomputing.stackexchange.com/questions/5019/why-...

gyf304··on Local Peer-to-Peer API Draft Community Group Report
I made something that achieved similar results with existing technologies by abusing STUN/TURN. It does not handle discovery but it does allow local communication without a server.

https://blog.yifangu.com/2024/07/16/crossing-the-mixed-conte...

gyf304··on SQLite FTS5 Extension
If you want to index HTML documents using SQLite FTS5, I have a HTML (pseudo) tokenizer plugin https://github.com/gyf304/sqlite3-fts5-html
gyf304··on I learned Vulkan and wrote a small game engine with it
I usually copy the built library from a Chrome/Chromium installation, saves me from building the library myself.
gyf304··on I made a new backplane for my consumer NAS
This is an awesome solution.

I have the 5-bay variant of the same NAS. I decided to put TrueNAS Scale on it using a Samsung USB stick using the internal USB. I chose one that’s widely used for Tesla dashcam, so I know it is at least somewhat durable.

I’m happy with it so far. I still find the CPU performance very lacking so I’m planning on upgrading to something beefier.

gyf304··on Show HN: Dotenv, if it is a Unix utility
This is a very neat project that seems to accomplish the same goal and have some extra features.
gyf304··on Show HN: Dotenv, if it is a Unix utility
* Memory allocation NULL check: this is a bona-fide bug introduced by my refactoring

* MAX_FILE_SIZE: I don't think this is true.

* skip_until_charset, skip_charset bound check bug: I don't think this is true

* Uninitialized value_end: I don't think this is true - and if true should be caught by -Wall -Werror flags.

* argc < 1 check not being necessary: This is not true, you can make argc == 0 by using the exec family of libc functions.

* Error Handling: Currently all parsing errors should cause the program to exit, which I think is the desired behavior.

* Unsanitized input for .env: Intended behavior.

* Unsanitized input for execvp: Intended behavior.

gyf304··on GM buys out nearly half of its Buick dealers, who opt to not sell EVs
The reason I think is that GM is multinational. And while Buick is not doing well in the US, it’s doing very well in China (80%+ of sales of the brand is in China).
gyf304··on Why I always hit the crosswalk button (2015)
The crosswalk button my city uses has an LED that illuminates if the button was pressed before. It’s a great UX improvement over the ones without the LED.
gyf304··on Building an occupancy sensor with a $5 ESP32 and a serverless DB
Did something very similar years ago - https://blog.yifangu.com/tag/library-occupancy-project/
gyf304··on Pixar, Adobe, Apple, Autodesk, and Nvidia form alliance for OpenUSD
Does anyone remember X3D[1] / VRML? X3D is roughly the same concept, 20-some years ago.

Here's a hello world for X3D: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecific...

And here's a hello world for OpenUSD: https://www.openusd.org/release/tut_helloworld.html#viewing-...

Although X3D is a bit more verbose, a lot of parallels can be drawn between the two, 20 years apart.

[1] https://en.wikipedia.org/wiki/X3D

gyf304··on Civic honesty around the globe (2019)
Thank you for your reply.

Here are my thoughts on your 2 points.

(1) Noted. The main graphic emphasizes reporting rate over the delta, in both the axes selection and the ranking - and indeed the ranking is the main takeaway from many of the readers. If you rank by percentage delta of report rate, the graphic would be drastically different. This newer graphic wouldn't be "fair" either, as countries with higher control (no money) report rate would have a relatively low percentage delta.

(2) The World Bank Enterprise Survey data is listed under the title "Percent of firms using e-mail to interact with clients/suppliers" (for which China is at 85%) which I think is not the same as email penetration rate (which in the above reference in my parent comment, is at <40%). I understand your reasoning that cross country data is hard to come across.

I also read your reply in Science. I believe that while there are multiple limitations conducting the research - all perfectly reasonable - the limitations nonetheless affected the credibility of Fig. 1 - the main figure of the paper.

It is also mentioned in the reply that creating new social accounts is unfeasible. While I think this is true, wouldn't a single account per platform suffice? Most social platforms allow anonymity for display names / handles. If the social account name does not bear resemblance to an actual name, I don't think the participants would notice.

gyf304··on Civic honesty around the globe (2019)
I believe the methodology is flawed.

> The business cards displayed the owner’s name and email address and we used fictitious but commonplace male names for each country.

This is assuming that email is a ubiquitous communication method in all countries, which is not true. USA has a very high email penetration rate, so does Japan (where all phones use email instead of SMS). On the other end of the spectrum, China's email penetration rate is less than 40% [1]. Business in China is conducted over WeChat and phone calls instead of email. If the person receiving the wallet does not have an email account, or doesn't even know what email is, I'd imagine the email contact rate to be quite low.

[1] https://www.twinova.com/email-dead-long-live-wechat/#:~:text....

gyf304··on Mischievous NPM Publications
I know exactly where this is from. This has been floating around the Chinese Internet for a bit. The repo is originally at https://github.com/wheatup/evil.js but has been made private since then. A few variants of this was made and uploaded to NPM.

Here's a English translation of the README.md in that specific repo.

> What? The notorious 996 company wants you to hit the road?

>

> Do you want to leave a small "gift" for your project before you go?

>

> Let's sneak this project into yours, and your project will have, but not limited to, the following magical effects:

>

> - When the length of the array is divisible by 7, Array.includes will always return false.

> - When it's Sunday, the result of the Array.map method always loses the last element.

> - There is a 2% chance that the result of Array.filter will lose the last element.

> - setTimeout will always trigger one second slower than expected.

> - 10% of Promise.then will not register on Sundays.

> - JSON.stringify will change uppercase I to lowercase l.

> - The result of Date.getTime() will always be one hour behind.

> - There is a 5% chance that localStorage.getItem will return an empty string.

see: https://juejin.cn/post/7133134875426553886

gyf304··on Show HN: I built a custom USB Trackball
Something about the use billiard balls immensely amuses me. I'm impressed.
gyf304··on TinyPilot: Build a KVM over IP for Under $100
Such a device exists and can be bought from Amazon for less than 20 dollars. Keyword USB HDMI Capture.
gyf304··on The silenced deaths of the Shanghai 2022 lockdown
We must protect human lives at all costs, even at the cost of human lives.

Jokes aside, what we really want to know is that - what are the human lives lost lockdown v.s. no lockdown, maybe also factor in the possible economic downturns. The government did a not-so-good job convincing people that doing a lockdown is indeed better than the alternative - "We ran the numbers, it seems like doing a lockdown at this stage is beneficial" sounds better than doing a lockdown just for the sake of it.

And: limiting information to people doesn't help boost confidence.

gyf304··on Mining Ethereum on M1 Mac GPU
You can see this line from the log. Using Device : Intel GPU 0.0 Apple M1 OpenCL 1.2 Memory : 10.67 GB (11453251584 B)
gyf304··on Mining Ethereum on M1 Mac GPU
I suspected that as well. Since M1 CPU and GPU shares memory, this also means you really can't do anything else while mining. You can't even scroll a webpage smoothly.
gyf304··on Uxn is a 8-bit virtual stack machine
There’s also ZPU. Which is straightforward enough to write an emulator for in an afternoon.

https://en.m.wikipedia.org/wiki/ZPU_(microprocessor)

gyf304··on Ask HN: Are you experiencing kernel panics on your M1 Mac?
Yes. Mounting WebDAV and creating a directory in it causes immediate kernel panic on M1 Macs. Fun.
gyf304··on Supermicro Hack: China Exploited a US Tech Supplier over Years [2021 Follow-Up]
I would like to plop this link here.

Bloomberg News Pays Reporters More If Their Stories Move Markets: https://www.businessinsider.com/bloomberg-reporters-compensa...

Bloomberg reporters have every incentive to publish a story like this, even if it's nonsense.

gyf304··on Show HN: Go-style JSON Marshal / Unmarshal for C structs
CMarshal brings Go style JSON marshaling / unmarshaling to C.

You can generate cJSON based JSON serializers and deserializers by adding a /* cmarshal:`true` */ comment to your C struct.

Potential use cases:

* Auto-generated JSON config parsers

* Simple struct printer (as a debugging mechanism, my goal in mind for this project)

* Introspecting C structs using cJSON API

* Easily bloat your program line count! (not the intended use case, of course)

Let me know how you think about this.*

gyf304··on Show HN: LAN Party VPN – Run a VPN on Top of Discord
I’ve been in lock down in a while (haven’t we all?). One of my major past times is to play games with my friends on Discord, and after a year we’ve ran out of games to play and started to look at classic games. Those games (namely SWAT4) are old enough to not support Steam multiplayer. However installing and setting up a VPN is quite a non-trivial process for non-techies.

So I took some time and wrote this application that uses Wintun and Discord SDK to encapsulate and transport IP packets (i.e. a layer 3 VPN running on Discord infra). It works reasonably well with my friends so I want to share it here.

gyf304··on Show HN: Vmctl/Vmcli – Easily Run Linux VMs on M1 Macs
I recently got myself a M1 Mac and I want to run Linux on it. By reading the docker M1 tech preview release (https://www.docker.com/blog/download-and-try-the-tech-previe...), I was made aware of the existence of Virtualization.framework on recent macOS releases.

Virtualization.framework provides 99% of the building blocks for running a Linux VM on a Mac, but there’s no off-the-shelf CLI for running a VM.

Inspired by https://github.com/evansm7/vftool, I wrote another CLI (vmcli) with some more features (better termios handling / escape sequence detection) in Swift, and build a script (vmctl) to daemon-ize vmcli and help manage VMs. I also made a script for provisioning a Ubuntu VM, so you can run a Ubuntu VM from scratch in minutes.

gyf304··on Show HN: Wasmino = WASM and Arduino – Running Arduino Code in Browser
I completely agree with you that Arduino is incomplete with out the actual hardware. Especially given that Arduino and Arduino clones are incredibly cheap these days. This is more of a fun project which I hope would be useful in specific scenarios.
gyf304··on Show HN: Wasmino = WASM and Arduino – Running Arduino Code in Browser
That looks great!
gyf304··on Show HN: Wasmino = WASM and Arduino – Running Arduino Code in Browser
Wasmino is an Arduino core fully compatible with the Arduino IDE. It allows you to compile your Arduino sketch to WebAssembly and run it in a browser, all using the Arduino IDE.

The Arduino IDE usually requires a physical board, which can be cumbersome. For example in a classroom setting: holding up an Arduino board showing the entire class a LED blinking is not very doable. This is where Wasmino can be used. Wasmino can also be used as a stop-gap during the first few classes, giving students time to purchase an actual Arduino board. Other solutions exist such as 123D Circuits. Wasmino is different as it is integrated with the Arduino IDE, providing a seamless experience - using Wasmino is just like using an actual Arduino board. Migrating to a physical board is also as simple as selecting another board in the Arduino IDE. I believe this is valuable in a classroom setting. Wasmino is also open-source, while most alternative solutions are not.

Needless to say, this project is in a very early stage - feedbacks welcome. Also if you can think of other use cases, let me know!