HNHacker News
TopNewBestAskShowJobs

shric

1,482 karma · joined November 6, 2012

submissionscomments
shric··on Flappy Bird in 1000 lines of C
Too many people have replied to my post saying I'm wrong in some way, so rather than replying the same thing to almost every single comment, I'm going to reply to myself.

My original response was to the person claiming that it was basically cheating to use SDL. You need abstraction, so there is nothing wrong with having SDL in the way.

Someone said that it's C all the way down. It's not. The Linux kernel is not 100% C and it cannot possibly be.

There are no C facilities to:

- Read a keystroke and/or mouse (required for Flappy Bird) directly. C only supports reading from the stdin and stdout streams.

- Generate graphics (more on this below).

As I mentioned in the original post, some operating systems let you write straight to graphics memory.

While you can technically do this in C with a pointer to an address, you're still going to have to issue e.g. a BIOS call to set the mode to something other than the default text mode. But we can let that slide.

There is absolutely no way to do "C all the way down" when reading and writing I/O ports, executing interrupts, etc. which is required for I/O beyond just the buffered stdout and stdin streams that C provides.

Linux of course provides things in /dev, but they're also not C all the way down.

If there was a hypothetical computer which supported all graphics and other I/O via reading and writing to/from streams, then sure, but I don't think that computer exists.

I know very well what C can and cannot do, I've been using it for 40 years.

shric··on UK bans daytime TV ads for cereals, muffins and burgers
Indeed, I am mostly in ASX:IVV (another S&P 500 ETF) and it charges 0.04% per year.
shric··on UK bans daytime TV ads for cereals, muffins and burgers
I was very careful with my words. I said:

> The punter does not win on average with stocks due to fees and spread.

Literally 100% of my investing is the stock market. I have so much faith in the stock market that I rent because I don't want to waste the opportunity cost on equity in property.

A punter is informal slang for a person who gambles. I buy and hold a diversified portfolio of index funds over decades. I am very much not a punter.

shric··on UK bans daytime TV ads for cereals, muffins and burgers
The punter does not win on average with stocks due to fees and spread.
shric··on Flappy Bird in 1000 lines of C
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code.

The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even when you can't do keyboard or mouse input in C without library and/or kernel support.

shric··on Flappy Bird in 1000 lines of C
Yeah, it still seems like a reasonable choice if you're going to write a simple game in C.
shric··on Linux 6.13 will report the number of hung tasks since boot
It could be any of the above, I'd say it's info because the kernel itself is not in an error state, it's information about a process doing something unusual
shric··on Is the 80 character line limit still relevant? (2008)
I have three 4K monitors and use a small font and think 180 is way too large.

Long lines are less readable and I want to have several terminal panes or editor windows side by side.

shric··on Something weird is happening with LLMs and chess
I'm actually surprised any of them manage to make legal moves throughout the game once out of book moves.
shric··on Something weird is happening with LLMs and chess
Stockfish level 1 is well below "lowest intermediate".

A friend of mine just started playing chess a few weeks ago and can beat it about 25% of the time.

It will hang pieces, and you can hang your own queen and there's about a 50% chance it won't be taken.

shric··on Jump Trading, Virtu and the 'hidden optical fibre cable' under an Ohio field
Exchanges have requirements imposed on HFTs to prevent this kind of abuse. This one would be no different.
shric··on Using an 8K TV as a Monitor
> The average American household uses about 29 kilowatts of power per day (29,000 megawatts).

Ignoring the megawatts error that the sibling pointed out, it's 29 kilowatt hours per day. Watts are a unit of power consumption -- joules (energy) per second.

One kilowatt hour is the energy used by running something at 1,000 Watts for one hour.

shric··on Using an 8K TV as a Monitor
I'm imagining a tiling window manager screensaver that slowly resizes and moves your window boundaries throughout the day
shric··on Using an 8K TV as a Monitor
i3/sway was recommended in the post, so yes.
shric··on How CERN serves 1EB of data via FUSE [video]
Google. I can't imagine Facebook having tens of EB.
shric··on Congress fights to keep AM radio in cars
I haven't listened to FM, AM, DAB, or anything broadcast since I've been able to connect my phone to my car (20 years?).

Why would I listen to what the station programmers decide (and possibly riddled with ads) when I can configure my phone to play whatever I want when I want?

shric··on How CERN serves 1EB of data via FUSE [video]
My frame of reference; the largest storage platform I've ever worked on was a combined ~tens of EB (give or take) and that had over a billion users.
shric··on Show HN: Facad – A colorful directory listing tool for the command line
I usually group similar type things into directories so that I don't get much of an extension mix. The exception is my download directory and for that I generally want to order by time or size.
shric··on Sublime text started adding a “.s” to new files
It doesn't make much sense. The only files I know of that are .s are assembly.
shric··on Exploring pre-1990 versions of wc(1) (2023)
A fun read on word count optimization can be found in Abrash's Black Book:

https://www.jagregory.com/abrash-black-book/#lessons-learned...

You can gloss over the asm if you wish, the tricks that are explained around it are worth it imho.

shric··on Linux dev swatted and handcuffed live during a development video stream
Not making any statement on causality but I wanted to take a look...

Firearm related deaths per 100,000[1]:

Germany: 0.065

US: 4.054 (62.4x higher)

Firearm ownership per 100 people[2]:

Germany: 19.6

US: 120.5 (6.15x higher)

If those stats are to be believed there's approximately 10x firearm deaths per gun in the US compared to Germany.

[1]: https://en.m.wikipedia.org/wiki/List_of_countries_by_firearm...

[2]: https://en.m.wikipedia.org/wiki/Estimated_number_of_civilian...

shric··on The Arrest of Pavel Durov Is a Reminder That Telegram Is Not Encrypted
Strange, I've been using Signal for years and its backup feature works just fine:

1. Enable backups. 2. Point it at a folder on your phone which gets synchronized somewhere 3. Note the 30 digit passphrase in your password manager.

https://support.signal.org/hc/en-us/articles/360007059752-Ba...

Have had no issue restoring to replacement phones.

shric··on On the cruelty of really teaching computing science (1988)
Somehow I guessed it was Dijkstra just from the title.
shric··on Every company should be owned by its employees
My comment was on holding them, not receiving.

That is, you should treat them like receiving cash and convert them into whatever you would normally do wisely with extra cash you received.

shric··on Every company should be owned by its employees
Also it's generally unwise to hold onto your employer's stocks that you were granted as single stock ownership is inherently risky. There's no reason to believe your employer's shares are going to beat the market.

Also, the majority of employees in a company other than small startups do not have the ability to shift their company's success materially to make it a worthy incentive to own and hold employer issued stock.

shric··on Pnut: A C to POSIX shell compiler you can trust
Master Foo long predates Python and Rust.
shric··on WHO says talc is 'probably' cancer-causing
It's worth listening, it's 53 minutes at 1x speed.

The main gist is that the list doesn't specify volume and the low quality of the data due to confounders. Also, conflicting studies.

Examples of things that will "probably" or "possibly" cause cancer:

Night shifts

Aloe vera

Talc

How many night shifts, and what is the risk increase? If you do 1 night shift will it double your chances of catching cancer, or will doing night shifts every day for 40 years increase your risk from 1 in 10 million to 1 in 9 million?

The list doesn't specify any further information.

shric··on WHO says talc is 'probably' cancer-causing
Past the edit deadline, but s/confidence/convinced/
shric··on WHO says talc is 'probably' cancer-causing
There was a recent (August 2023) The Studies Show episode[1] on WHO's cancer list. It goes in to why these lists are incredibly misleading.

My own mother died of Ovarian Cancer at age 40 and used talc. I'm not confidence for a second there is sufficient evidence to even hint at causality.

[1] https://www.thestudiesshowpod.com/p/episode-3-aspartame

shric··on Julian Assange has reached a plea deal with the U.S., allowing him to go free
I live in the center of Sydney. Every Friday in the city for as long as I can remember there's been a small but dedicated group of peaceful protesters gathering outside Town Hall. They must be over the moon today.
← PreviousPage 5 of 19Next →