See: man bash
, “Compound Commands” and “Shell Function Definitions”
See: man bash
, “Compound Commands” and “Shell Function Definitions”
I wish to all web developers who make a custom dropdown for dates in which you can’t just type the god damn date in to use this style of date selection for everything.
Amateur! I can read and understand that almost right away. Now I present a better solution:
even() ((($1+1)&1))
(I mean, it’s funny cause it’s unreadable, but I suspect this is also one of the most efficient bash implementations possible)
(Actually the obvious one is a slight bit faster. But this impl for odd
is the fastest one as far as I can tell odd() (($1&1))
)
No, silly. You ask chatgpt to write (steal) a loop that would generate all those lines. Haven’t you heard about meta-vibe template-programming?
I mean, it would be almost this exact thing in almost any language.
fn is_even(n: i64) -> bool {
n % 2 == 0
}
even n = n `rem` 2 == 0
def is_even(n):
return n % 2 == 0
etc
You kid, but Idris2 documentation literally proposes almost this exact impl: https://idris2.readthedocs.io/en/latest/tutorial/typesfuns.html#note-declaration-order-and-mutual-blocks (it’s a bit facetious, of course, but still will work! the actual impl in the language is a lot more boring: https://github.com/idris-lang/Idris2/blob/main/libs/base/Data/Integral.idr)
Lots of interesting answers here. I figured I’ll pitch in too.
IMHO there is no one true, universal meaning of life - just as there is no one meaning of any piece of art. I think the idea that everything around you must have a single meaning is a relatively modern one, which came from the requirements of efficient communication (which should indeed be precise and not open to interpretation).
As it stands, it is up to you to interpret the world around you and find different meanings for yourself, just as you should do with art. If you are struggling to start, consider those questions: What do you enjoy? What makes you happy? What do you think is “good”, even if it makes you sad or uncomfortable? All those things are your personal interpretations of meaning of life. Or go ahead and make up something else, I’m not your dad.
I was pondering why people fight so hard to beat diseases and live a few more years. What are they planning to do? Why exert effort just to be here longer when you don’t have a reason?
As for this, I think when people realize the proximity of death and temporal nature of their life, they are much better at coming up with meanings. Maybe it is to see your partner or your children for a couple more years. Maybe it’s another couple of gaming sessions with your pals. Whatever it is, when you realize you don’t have much of it left, the importance of it typically rises dramatically from your perspective. If you’re struggling to visualize something so dramatic, imagine that your favourite food will be completely banned and criminalized in your country in couple weeks. Wouldn’t you want to enjoy it more before that happens?
Eh, honestly sometimes I stumble upon code which was last modified in the last millennium and it’s usually fine. If has been working for 30 odd years then it stood the test of time and probably isn’t too janky. Selection bias strikes again.
If you’re trying to avoid a lot of those traps, shellcheck
is pretty cool. I have written my fair share of bash and yet still get caught off-guard by its warnings - and it’s right most of the time!
Honestly this made me really sad that we’re stuck with this archaic, awful language as a primary way of programmatically interacting with our computers. And I don’t mean to say anybody has done anything wrong here - sh and bash were revolutionary and amazing for their respective times, and maintainers who are keeping bash alive now are heroes who deserve praise. However, many decisions made when sh was originally developed turned out to be footguns, still creating bugs today (despite shellcheck et al).
nushell
is somewhat promising but flawed (because it has to be built on the same system interfaces as sh, after all). The most annoying is that there’s no facilities for setting any metadata on data streams (in particular there’s no way to set the format of the data) so everything has to be marshalled manually, which would be OK for a proper programming language but really annoying for a shell. At least it fixes most of the quoting, escaping, interpolation, substition etc awfulness, and allows for manipulating data in a more structured way.
I really don’t know if it’s even possible to make a language that would be a good convenient shell and at the same time not prone to bugs which are easily noticeable in other languages. I hope that something like this becomes a reality at some point.
Passing them as arguments can be even worse - depending on the configuration, process arguments of running processes can be seen by everything running on the machine.
Careful there. You are only a half dozen abstraction layers away from reinventing NixOS.
As for your question, the best way is to put it in a file that is then read by the chroot script and delete later.
There should be no updating unless enabled <…> and never nag the user.
I disagree, at that point you might as well continue using Win10. Security updates are the #1 reason to do this. Most computer use nowadays is networked (actually in a browser), and it’s super important we keep that updated.
If updating is turned on, it should be very conservative, updates hand curated by grandmasnixos, basically never uses software that hasn’t been proven rock solid for at least 6 months
Eh, this sounds like a lot of work. Probably just use the stable channels, and only manually test when switching to a new stable channel.
Rolling back any update should be one-click-trivial
Agreed, should also be very obvious (like a label on the desktop that says “Issues after update?” and gives you a button to roll back and reboot)
The desktop environment should be something occasional win10 using grandma will not get lost in
This is the main question IMHO. I’ve not used any DEs for a while, so don’t really know which one would fit this best while also being simple and robust.
I think we can be even simpler than that. Don’t ask any questions. Simply generate the hardware-configuration.nix
and have a single configuration.nix
that is unchanged:
configuration.nix
)npins update
and nixos-rebuild boot
, and finally annoys you until you reboot (it should also update to the next stable channel when that becomes available, and make that a big deal so that a user understands it might change some of their workflows)/home
, /nix
, and wherever flatpak are stored, is wiped on every reboot and recreated from the generation, so that “reboot it” is a viable troubleshooting strategy.Hmm, I’ll pitch this idea to a couple of Nixy lfriends, maybe we can hack something together. Also throw a Linux install party!
I’ve not used Guix but I don’t think any distro has anything close to number of desirable available packages as arch— so be prepared for that
nixpkgs would like a word
Most consumer hardware on earth does already (Android phones). The problem is those drivers are usually proprietary bullshit that’s very difficult to integrate with anything but OEMs kernel fork & Android version. Unfortunately I don’t really foresee that changing in the near future, hopefully if Linux becomes more mainstream, Linux phones become too and then we get some progress.
And for laptops/desktops, I think the situation is pretty good already as well. Many mainstream OEMs have an option with Linux pre-installed now, and the drivers there are mostly FOSS. I’m hoping that the problematic part vendors e.g. NVidia and Broadcom step up and provide sources for their drivers - otherwise they will continue to be a buggy mess that most people hate.
Expect a steep learning curve even if you know Linux inside out. Don’t assume things work the way they did on Arch (or most other distros). If your hardware doesn’t work well, or you otherwise need some proprietary stuff, check out https://gitlab.com/nonguix/nonguix. Good luck!
Physical media is the only media you really own.
Hard disagree. You can own any file encoded with an open standard. And it’s easier to index, search, manipulate, back up, etc. It feels more like owning than having the data on a micrometer-thick metal layer sandwiched in a fragile plastic disc that can easily scratch or discrot. There is a reason people have been ripping CDs since PC CD drivers became a thing.
Yeah, I agree that Elixir is a fine language for some tasks. I personally find the readability somewhat average, but it’s very maintainable (due to how it enables clear program structure), the error handling is great, and the lightweight process system is amazing.