HNHacker News
TopNewBestAskShowJobs

i-use-nixos-btw

644 karma · joined February 20, 2023

submissionscomments
i-use-nixos-btw··on What dif­fer­enti­ates front-end frame­works
I’m mainly a C++ developer, not a frontend developer (though I dabble), and when I have a choice of multiple approaches the first thing I do is go to godbolt.org, implement MWEs and compare the assembly.

I also do a lot of code generation, and my absolute goal is to have it write code that I’d write if I were doing it by hand. That’s pretty key for me. If the output is better, then good. If the output is doing a bunch of stuff it doesn’t need to be doing because it’s taking my specific use case and making it conform with its own model for doing generic things, I don’t like it.

I was a web developer back when tables for layout, HTML attribute soup for styling, and applets for interactivity were going out of fashion. Semantic HTML and CSS for layout and styling and JS for interactivity were coming into fashion. Divs for layout, class soup for styling, and JS frameworks for interactivity hadn’t yet become mainstream when I stopped.

So my default is lean HTML, lean CSS, raw JS. Maybe JQuery if needs be. It’s an outdated default, but it’s mine. The thing is, I get great load times and performance for what I need. What I need is normal dashboard stuff - though because of the nature of the field I work in, it condenses a lot of information onto a page and that information is updating many times per second.

I don’t seem to get enough performance from the frontend frameworks I’ve tried. I don’t know if it comes from code bloat, or deep call stacks through god knows how many levels of indirection, the way DOM updates are issued, or something else - but it has just never seemed worth the learning curve to end up with something I can’t do myself with admittedly a lot of work.

As such, I find this review helpful. Svelte has caught my attention and I want to give it a go, but if the output is bloaty then that’s a red flag for me. If it’s bloaty because it isn’t doing backflips through the call stack, but is inlining code - that’s familiar territory and certainly something I can deal with.

i-use-nixos-btw··on Swig – Connect C/C++ programs with high-level programming languages
I used swig for a long time. It's really handy.

If you're just targetting python, and it's your first venture into building python extensions, it's fantastic. After a while, it's worth trying out building an extension without the use of swig. Much of the time, it's easier to use than swig is - but you do have to implement all the bells and whistles yourself. If you're writing in C or C++, chances are you like that kind of thing anyway.

i-use-nixos-btw··on The English Programming Language
> There are millions of English libraries available. You can look for the closest in Google Maps.

LOL!

Though I have a bug report. There are actually only 320k. This makes me feel sad.

i-use-nixos-btw··on C++23: The Next C++ Standard
When I learned C++, there was no auto. Range-based for loops didn't exist. The combination of those two were particularly nice because instead of writing:

  for(std::vector<sometype<int>>::const_iterator it = my_container.cbegin(); it != my_container.cend(); ++it){
    // use *it
  }
You could use:

  for(auto const& val : my_container) {
    // use val
  }
Which really paved the way for less hesitation around nesting templates and other awkward things.

Same goes for map with the introduction of structured bindings:

  for(std::map<somekey, sometype<int>>::const_iterator it = my_map.cbegin(); it != my_map.cend(); ++it){
    // use it->first, it->second
  }
became

  for(auto const& [key, val] : my_map) {
    // use key, val
  }
The introduction of std::variant made state a lot easier to reason about. Unions meant too much room for error, and cramming polymorphism into places it shouldn't have ever been was riddled with its own performance and memory issues.

std::optional was also a game changer in that regard.

constexpr was huge. It killed off a bunch of awkward template metaprogramming for something faster to compile and easier to deal with. I wasn't a part of the consteval discussions but from what I HEARD people say about it and what it actually WAS, I think it was castrated at some point along the way.

Concepts, also a big one.

Formatting (RIP iostreams) is much nicer than the alternative.

Ranges, coroutines, modules - they'll have their day too.

And we have a bunch of stuff to look forward to. Senders and receivers solves a lot of component interaction problems. Reflection will rid us of so much annoying provisioning of classes. Pattern matching and expression statements will be major usability boosts.

Ok, C++ doesn't move at the speed of newer languages, but for its size, complexity and all of the hurdles that it has on the way to standardisation, I think modernisations are many and often successful.

I would absolutely love a major break that fixed things we can't currently fix due to ABI risks, implementer resistance, etc. I'd love to rid us of the old ways™ and focus on safety the right way™ - by removing bad bits rather than just adding good bits and telling people to use them and follow a bunch of guidelines. I'd love better defaults.

There is so much work to do to make C++ great again puts on MCPPGA hat, but I can't agree that modernisation are few and rarely successful.

i-use-nixos-btw··on C++23: The Next C++ Standard
Aside from the syntax (I find it ugly, you find it visually appealing - it's subjective), iostreams are inefficient, awkward to customise, not thread safe (allows interleaving), and mix format and data (that one is also subjective).

I love me some operator overloading. I love / for filesystem separators, I love | for piping things. I don't like << and >> so much but that's just because of too many years of writing them everywhere.

i-use-nixos-btw··on Linux Lite: Easy to Use Free Linux Operating System
Some ads - fine. Selected and appropriate ads - fine.

Let me explain via my experience of THIS website on an iPhone.

A banner ad appears at the very top, covering most of the cookie notice. I would be surprised if this doesn’t violate EU law.

Upon collapsing it and agreeing to give my soul to the Cookie Monster, another ad takes up most of the screen. This ad, ON A SOFTWARE SITE, says “download now! Start downloading. Download your copy now [green arrow]”, with a small logo at the bottom left saying “learning lab”. ON A SOFTWARE SITE.

I scroll down half a page. Another banner ad appears.

Then I see a tiny amount of information in an infographic followed by a form to donate in US $ or EU $ (not € - they’re asking for euros in $…).

Below that, another Download Now ad, this time from The Books Master. It takes up half the screen.

Then a bit more content. Some testimonials too. Then… another half screen ad. Then the page footer and another half screen ad.

From my estimation, 50% of the page is ads, two of which are deliberately misleading (on behalf of the advertiser).

I have absolutely nothing against ads, but this takes the biscuit. I would absolutely not be surprised if this was done in prep for posting to hacker news, knowing the views it’s going to get - but Id also not be surprised if it’s just designed by someone who doesn’t understand the dreadful public image that this has.

I’ve never heard of the distro. It doesn’t look like it’s designed for the likes of me anyway (clue’s in my username). But I could never direct someone to a site like this.

i-use-nixos-btw··on Rejected GitHub profile achievements
“The thief”: When your approach to open source is that you close pull requests and merge the diff manually under your own name.

So many large corporate-run projects do this and, while I’m sure there are some compliance reasons, it just looks dodgy.

i-use-nixos-btw··on Ask HN: Any hardware startups here?
A full on helmet? That’s awesome.

I reject the claim that there is no killer app. Have you not seen Judge Dredd? ;)

But seriously, I like this. Honestly I think I’d rather this than a normal headset. There are so many design challenges and compromises made because of the notion that they should only cover the eyes. But that approach just leaves us looking gormless to any onlookers, so there’s not much aesthetic benefit.

Meanwhile your design looks, for lack of a better word, badass.

i-use-nixos-btw··on Ask HN: Any hardware startups here?
That sounds very cool.

I have to ask - do you build parts for your machines using your machines?

i-use-nixos-btw··on Ask HN: Any hardware startups here?
Likewise, the big players in any field spend vast resources on R&D to produce the better products, and the patent is the only thing that makes that sustainable.

It’s all well and good wanting the world to be a safer place, but every company is beholden to its shareholders and debtors. Resources spent must be recovered or it all falls down.

i-use-nixos-btw··on Ask HN: Any hardware startups here?
It depends.

The thing about the baby market is that, because it’s driven by emotional decisions, there are buyers at every price point - and it isn’t even directly related to wealth. Some people get into debt trying to make this harsh world safer for their newborn, even though safety benefits taper off as the price increases.

For me, I picked the lower bound and my wife picked the upper bound on the price range we were looking at. She is frugal above all else, I am safety conscious above all else. We met in the middle and found one that suited.

It required some negotiation to begin with though, because her upper bound was lower than my lower bound - and was firmly in the “dodgy unbranded wholesale, sold on a website with an invalid SSL certificate, claiming to be UK based but registered to a Chinese address” territory.

i-use-nixos-btw··on Ask HN: Any hardware startups here?
This sounds very cool. Wait, no, hot.

In a factory setting, there is a bunch of heat wasted in other processes, e.g. waste heat from machines. Is this heat collected and fed into the air source?

i-use-nixos-btw··on Academic research straight from the horse's mouth
This is an interesting concept. I like it.

There isn’t any real information about the site available though, or not that I can find anyway. No about page, no T&Cs covering e.g. who owns the rights to the audio, no FAQs, etc.

The audio clips could do with the ability to rate and comment, e.g. to discuss the work, or to suggest improvements about audio quality etc. You could also do with a place for creators to chat about ideas, if you don’t have one, be it a forum, discord, or a social network (which looks like the direction this idea is heading in eventually anyway?). I’ve listened to a few clips and I think it’d be interesting to see contributors team up with animators to add visual appeal to the content too.

Anyway that’s enough of my points of improvement- I think this is a great idea.

i-use-nixos-btw··on Rip Current
I got caught in one when I was a kid.

They don’t take you out very far, but they push you away faster than you can swim, and it’s the struggle that gets you.

I hadn’t been told about them so I didn’t know what was happening, or that I just needed to move sideways. It isn’t obvious that you’re in a channel of water, and you just kind of notice that everyone is suddenly getting quite far away.

It got kind of scary and I tried to swim against it but it wasn’t working. I saw that I was drifting towards some small fishing boats so decided to swim with the current instead.

Problem is, scale is an illusion. By the time it stopped, the boats were still in the distance, but so was the beach. That’s when I got scared.

I don’t know for sure, I was young, but I think it was around 100 meters out. I swam back (it felt like it took a long time, but that’s probably because it was so cold - the UK isn’t famed for its seasides!)

But when I got back I ended up a fair walk away from where my family were lounging around, mum reading a book, dad making a very bad attempt at using a disposable barbecue. I told them what happened and they didn’t believe me.

i-use-nixos-btw··on Wake Up (Pope Francis Album)
Track 7 (wake up) kind of feels like it’s loosely inspired by Baz Luhrmann’s “Everybody’s free (to wear sunscreen)”.
i-use-nixos-btw··on Lev Landau's “Theoretical Minimum”
It’s a strange feeling reading Ioffe’s memoir.

When I was a physics undergraduate, I understood the mentality. The high-maintenance asshole professor was exactly who I’d be drawn towards. I learned how unhealthy that was, and many of those who didn’t ended up burning out HARD.

Landau was the rare asshole whose ability to hone students was worth the abuse. And reading this, I found myself in the frame of mind of “yeah, in that scenario, I’d absolutely work my ass off just to be in that guy’s favour”.

Years training myself out of that unhealthy mentality and boom, a few pages of memoir and I’m back in that naive frame of mind.

i-use-nixos-btw··on Case study: Algorithmic trading with Go
Oh, one more thing. Your bar method.

Are you using number of trades or sum of trade sizes?

Because if the former, there is little distinction between me firing off two market buys of 100 shares each in quick succession vs me firing off one market buy of 200 shares, so your sampling shouldn’t be impacted by the difference.

I’m not altogether convinced by volume sampling. It’s an idea popularised by De Prado, but I’ve never seen it actually work in practice. It makes you trade more when the market is going through turmoil, it makes you trade more over time (as volume per day generally increases), and I haven’t seen any evidence of the importance of information content.

If you’re trading based on patterns in the market, it’s easy to lead yourself to believe that you’re predicting the market. That isn’t the case, though - the market is formed of many many independent people making guesses.

The thing you’re actually doing is predicting what other people are going to predict. If there’s an established pattern, like some moving average crossing another or a wedge or anything else like that, the reason it tends to complete is not mystical - it completes because other people see the pattern, think it’s going to go up (or down), buy (or sell), and then that has the effect of pushing the market in that direction (it also means that anyone late to the game can’t benefit from the movement).

As such, the strongest strategy when trying to use technical analysis to determine possible market moves is to use the resolution that everyone else is using. This is overwhelmingly time-based. There are people trading in the 1s regime, the 1m regime, the 15m regime, etc, and they’ll often stick to that and execute trades with a proportional rollout time and aim for a proportional profit.

If you pick just a random number of trades or amount of volume that suits you, you can easily find that you are out of sync, competing against no one in particular, and you’ll see that it’s impossible to find a pattern.

Many other people use price levels. So they’ll have their limits and stops at round numbers, or at percentage changes on the day, week, month, etc. So there is an argument for price bars too.

i-use-nixos-btw··on Case study: Algorithmic trading with Go
Nicely done.

A couple of pointers. One on data, one on that RAM usage.

First I’ll go with the RAM usage because this is hackernews and everyone loves algorithms.

—-

There are a lot of libraries out there that do technical analysis, and most of them are designed for batch processing. TALib is an example - it works on large data sets but is not appropriate for live trading because it repeats calculations over and over and over again. If you have 10000 datapoints and calculate indicators, it’ll calculate 10000 of them. Add one more bar, now you have a dataset of 10001 items, which TALib will calculate the indicators on from scratch. Or maybe you just feed the last 10000, and still perform that calculation over all of those, but save that 10001st oldest one. Either way, it’s bad. Same goes for every library I’ve seen, presumably because no one would open source a production grade indicator generation system.

The production approach to this is somewhat different. Turn your features into state engines. Most features are just running calculations that are very easy to perform once per bar.

Moving averages are a perfect example - for a moving average of N bars, store N items in a fixed size array on the stack and keep track of the latest index to be written to. When a new value (X) comes in, increment that index, and grab the value (Y). Modify your old mean by adding (X-Y)/N. Then write X over the old value Y (It’s a ring buffer).

For EMAs, it’s even easier, because you just need to keep track of a numerator and a denominator - nothing else is needed. On a new value X with the scaling factor A (such that A^halflife = 0.5), the numerator N becomes NA+X and the denominator D becomes DA+1. Divide the two and you’ve got your new value.

If an indicator depends on another, don’t recalculate it. Break the indicators down into fundamental calculations and you’ll often find a lot of redundant calculations being done. Rearrange it all so it fits. Automate that process if you enjoy that kind of thing like I do.

Most indicators can be handled this way. The indicators that can’t - are rarely useful. After all, what you’re tracking is the evolving state of the market, and if you’re doing gymnastics over an indefinite number of bars, it probably doesn’t mean much.

The end result is that you don’t end up accumulating memory throughout the day. You receive a bar, you throw it through your indicator generators (all of which using a fixed size of memory), then you discard the bar and wait for the next. Save state at the end of the day and load that on the following market day.

The result will be a speed up like you couldn’t imagine. I promise. I run an indicator generation engine in a container capped at 40MB ram on one CPU, and it generates hundreds in much less than a millisecond after the bar arrives.

—-

Now, onto data. I recommend cleaning your data. You have a screenshot of a Tesla chart in there with some funky highs/lows every so often. It has been a long time since I’ve worked with US equities (and gladly so, it’s a mess of a system!) but the following is the best of my recollection.

The trades you receive will come from several sources. For US stocks, there are several different venues that operate their own order books. These will operate as typical markets between the open and close of the day. By typical I mean that the bid and ask represent what you’d get if you market order instantly (which you can’t), and the market trades on them have to take from the bid and ask side of the order book (formed by people placing limit orders).

However. There’s also the ADF - the Alternative Display Facility. This is the DIY of trade reporting (and quote reporting, but no one does). If someone sells some shares to their grandmother for a low price in exchange for the recipe to her famous apple pie, the ADF is where they can tell other participants about that trade, manually, subject to fat finger errors, prices of weird fractions of cents, and very relaxed constraints on timing.

It’s also where dark pools post trades.

The problem with this is that this data has no direct relationship to the rest of the market. This is why, every so often, you’ll see those blips.

If you don’t clean them, they’ll play havoc with any indicator that uses highs and lows.

The other problem is that ADF trades - at least when I last analysed this very issue - are not rare. They make up a large fraction of trades. So my approach was to clean ADF trades more rigorously than the venues by matching them against prior prices from an ADF-free background.

i-use-nixos-btw··on Wayland is pretty good
Hyprland, which I believe is based on Sway but I’m not sure.

Either way, most of the problems I’ve been having do not seem to be implementation specific, and instead stem from buggy usage of the protocol. It’s no secret that Electron’s wayland support is an ongoing problem, for instance.

i-use-nixos-btw··on Code the shortest path first
Absolutely. A PoC is supposed to be badly thought out, that’s the point. Get from A to B quickly, in whatever way possible, and then get feedback while building the real deal properly.

There has been some pushback against that idea on here, but I’m firm on it.

My approach these days is actually to get the PoC done with a lot of assistance from ChatGPT and copilot. It generally works great and fulfils the basic criteria, but isn’t production grade in the slightest. That’s fine - it means I can provide PoCs in the space of an hour or two, and it gives me something to aim for and refer to.

i-use-nixos-btw··on Wayland is pretty good
There’s a subtlety here. Something can still have a few bugs without being bug ridden. It’s the difference between a puddle and a flood.

X11 with i3, the setup I’ve used for years, is not bug ridden. There are quirks, but nothing fundamental, nothing that makes it a bad user experience.

Wayland, on the other hand, has been a dreadful experience. Some of the most fundamental things, like cursor rendering, window rendering, multiple monitors, clipboard, all have problems doing the basics.

To be clear, this is what I actually expected. My disappointment is that people have been preaching about Wayland for years, pushing a stronger and stronger line that it is fantastic, has great support, and is ready to switch to now. That just isn’t the case.

i-use-nixos-btw··on Wayland is pretty good
Wayland as a concept is pretty good.

But I would strongly urge anyone from switching to it unless you have nostalgia about the bug-ridden nature of the 2010-era Linux Desktop.

I’m still using it, by the way, with Hyprland, but I think I’ll be switching back to X11/i3 soon. Here’s a taste of my experience thus far.

Electron apps are a mess. This isn’t (all) wayland’s fault but for issue lists like https://github.com/electron/electron/issues?q=is%3Aissue+is%... to exist, proponents of wayland would find it in their best interest to tackle the problems given the large number of applications that use electron.

Screen sharing doesn’t work. All the old fixes are to be ignored - it has regressed. Again. Font sizes are screwy. VSCode simply doesn’t work. The handy slack shortcuts like ctrl+shift+space for mute that work anywhere only work when slack is focused on Wayland.

If you have multiple monitors of different scaling factors, moving a window from one to the other results in it becoming unbearably blurry.

wl-clipboard and vim with clipboard=unnamedplus (the only reasonable clipboard) simply don’t work well together, and have a history of bugs going back for FOUR YEARS. At the moment, holding down x or d for repeated deletes is INSANELY slow. As in, I’m used to it working at my repeat rate of ~60 deletes per second and it barely does 3.

Every now and then, my cursor becomes huge. Every now and then, it becomes tiny. No idea why, and I’m afraid to ask.

Basically, it’s not a comfortable experience.

i-use-nixos-btw··on Code the shortest path first
An alternative: Build a PoC first.

The reason coding the shortest path first feels better is that you hit milestones early. However, it is a major generator of technical debt, and fleshing out the project is the hard part that takes longer and introduces breaking changes.

Taking time to plan, getting the API planned in advance, generalising the code (obviously not TOO much), and so on might feel less rewarding at first, because the early milestones are the hard part. But do it right and you end up seeing everything fall into place in quick succession, according to plan - and that’s a much greater sense of achievement IMO. It is often also a quicker way of seeing large projects to completion, though it doesn’t always feel like it at the time.

Building a Proof of Concept allows you to get the best of both worlds. It allows you to be naive, it allows you to write the bare minimum, and it gets something working that others can try out and give feedback on. As a bonus, it doesn’t generate technical debt, because you don’t build on the PoC - you use it as a reference while building the actual thing.

i-use-nixos-btw··on US Congress doubles down on claims of illegal UFO retrieval programs
I don’t believe such projects actually exist, and my two theories are a bit whacky, but one of:

1. They’re actually used as ways of laundering money out of government pockets without congressional oversight. The whole “oh but it’s top top secret” excuse is an easy one.

2. The positive and negative attention are all part of a plan to convince enemy nations that the US has access to incredible technology. I mean, if I wanted to spook Putin, I’d probably also sign a bill condemning the work on the trillion megaton nuclear bomb. What trillion megaton nuclear bomb? The one we’re condemning!

But let’s pretend it is real.

What is the point of congress withdrawing such funding? Elon steps in, and then such tech is in the hands of a private company rather than the government. How is that a good thing for the US govt?

It sounds (to my naive British mind, which knows very little about congress or its stance on various things) that it’d have been preferable to give a timeline for these projects to present themselves to congress. Immediately condemning them and convincing whistleblowers to present them instead just seems like a backwards way of doing it.

i-use-nixos-btw··on Every factorial approximates a power
I think it’s clear to the author and every reader that it wasn’t a misunderstanding.
i-use-nixos-btw··on Every factorial approximates a power
Scroll down below the article:

> My colleagues and I have decades of consulting experience helping companies solve complex problems involving data privacy, math, statistics, and computing.

> Let’s talk. We look forward to exploring the opportunity to help your company too.

Getting more attention then clarifying the intent in the body is sometimes mischievous (read: every tabloid newspaper), but it nonetheless brings more good attention that it would have without the click bait. If that leads to more consulting work for the author, good for him.

(it kind of feels weird calling a high-number approximation “clickbait” but, in some circles…)

i-use-nixos-btw··on The Pentagon’s $52k trash can
That’s all well and good, but as soon as the mass manufacturing of the item halts, it’s no time at all before the assembly machinery is dismantled, the people reskilled, software updated, supply chains cut, etc.

So when they’re approached to make some more, what are they going to do? The easy answer is turn down the request, and I wouldn’t be surprised if they did. Then they’d have said something like “the person who made these retired three years ago, the machinery is now scrap metal, the software for that machinery is on a floppy disk in a recycling centre somewhere, I don’t even know how who sold us the materials, and whatever we can do to replicate it would be considered a new product that has to go through testing again. So if you want this it’d take a lot of resources, and cost hundreds of thousands of dollars.”

To which the response would have been: “get it done.”

I’m sure there was some added on to sweeten the deal, mind, but that isn’t the outrageous thing, nor would it be as dramatic as it sounds. The outrageous thing is that Boeing would have specifically outlined the end of production of components years in advance, and that would have been opportunity to buy and stockpile while the price was reasonable. Of course, some middle manager would have said “lol no it’s just a bin, we will just get one from Walmart”, and the complications would have only been realised when it was too late.

i-use-nixos-btw··on Google uses in-person office attendance as part of employee performance reviews
What’s the important metric? Performance.

What’s one of the measures they use to establish performance? In-person attendance.

Why? Because it… improves… performance?

I mean, that’s just like testing to see how warm a house is by seeing how often the heating is turned on. Except some houses are in Cuba and some are in Siberia. It’s the wrong approach.

But meh. The largest company I’ve worked for had 0.5% of the staff Google has, so who am I to say what does and doesn’t work as a metric for them? It’s an entirely different ballgame, and not one I think I would enjoy being a part of.

i-use-nixos-btw··on Manjaro is a free and open source Linux operating system that emphasizes privacy
It changed the way I use computers. Absolutely love it. Though I moved to Hyprland a few months ago and it's very similar, but for Wayland (and a slightly nicer look, but not without its own quirks).

Funnily enough, I moved to Hyprland when one of the Jupiter Broadcasting podcasts (Linux Unplugged possibly?) talked about it. So from this thread alone you can tell that I'm quite easily influenced!

i-use-nixos-btw··on Manjaro is a free and open source Linux operating system that emphasizes privacy
I used Manjaro for a while, because they had an i3 community edition and, well, I wanted to give i3 a go. I think it was DistroTube that convinced me to try it and, honestly, I loved it.

It’s a slippery slope, though. Manjaro is just a gateway drug to Arch, and Arch is just a psychiatric test to see how many things perpetually break on you before you snap and move onto the paradise of NixOS.

Yep. I went there. Of course I was going there. My username checks out.

← PreviousPage 3 of 6Next →