Software engineer, functional programming enthusiast.

  • 1 Post
  • 109 Comments
Joined 3 years ago
cake
Cake day: April 27th, 2021

help-circle
  • I would go with Guile, because it is built-in to the Guix Package Manager which is a really good general-purpose package manager.

    It ticks several of your boxes:

    • has a CLI interpreter
    • is a general purpose language, Scheme, amd compliant with revisions 5, 6, and 7 of the language standard
    • allows writing in a functional style (it is one of the original functional programming languages)
    • small disk footprint, but still large enough to be “batteries included”
    • decent documentation, especially if you use Emacs
    • simple setup: not so much, unless you are using Guix to begin with. The standard distribution ships with lots of pre-built bytecode files, you need an installer script to install everything.

    It also has pretty good libraries for system maintenance and reporting:


  • I’m a communist but I suddenly realised that American conservatives should all be hardcore Linux enthusiasts. Why is this not already the stereotype?

    Libertarians and conservatives in the US demand liberty only for the already wealthy and powerful upper class, the liberty to enslave and exploit whomever and whatever they choose. They believe the ultra-wealthy have somehow earned the right to do so. On the contrary, the socialists, especially the anarchists, are opposed to unjust hierarchies, and the hierarchy created by wealthy and politically powerful classes are the most unjust of all – quite the opposite of the libertarians and conservatives.

    Libertarian (Liberal) propaganda appropriates the more popular socialist ideologies while conflating liberty for only the wealthy/powerful versus liberty for all people. One can see appropriation done in the same way in the very name of the National Socialist (Nazi) party of Germany. These tactics that were used by the Nazis are still used by various American conservative and libertarian parties, who mostly align under the umbrella of the Republican Party. Just look at what the Trump cult weirdos are all saying nowadays. It is pure KKK and Nazi ideology resurrected, under a thin veil of euphemisms.

    So if you take at face-value what libertarian and conservative politicians in the US say publicly about freedom, small government, civil liberties, etc., then they ought to be very enthusiastically in favor of Linux, but it is all just propaganda. They don’t care about freedom, only freedom for the elite clique of their supposed “supermen,” the wealthy elites, the freedom to exploit groups of people who they hate most — take your pick: foreigners, black people, women, gay and trans, Jews, Muslims, the “woke,” the “leftist,” etc. The libertarians and conservatives hate things that benefit society at large, because what benefits society also benefits these people they hate.

    Linux is pretty authentically a community project for the good of society, and it is truly subversive to the authority of the corporations and elites. So the various libertarians and conservatives of the US recognize Linux as a threat. Only that small group of privileged, middle-class libertarians stupid enough to be duped by the wealthy elite propaganda believe that free software is aligned with their ideology.


  • both can be installed side by side if you have enough disk space.

    Yeah, this is exactly what I do using QEMU and Aarch64 Debian. I suppose I could try the Asahi Linux in QEMU but that actually might be more difficult since I don’t think QEMU can emulate the MacBook hardware, as far as I know. And I can’t do dual boot, I want to be able to switch back and forth between Mac OS and Linux without rebooting anything.



  • I switched to Linux permanently in 2008. Last OS I used before Linux was Mac OS X version 10.4 “Tiger” (if I recall correctly) which is what came with the Macintosh PowerBook that I had bought roughly in the year 2004. I have never used Microsoft software unless someone was paying me to, but at the time, Windows XP was still all the rage even though Microsoft was trying to get everyone to switch to Windows Vista. (Vista got a lot of well-deserved hate too, sort of similar what we see with Windows 11 right now, actually.)

    Anyway, I was a die-hard Apple fanboy, but getting more and more into free software and I kept on using Macports/Homebrew to build Linux stuff I found online, but back in those days a lot of apps I wanted to try did not have good support for the Darwin kernel build of GCC which was pretty old compared to what Linux was using at the time. Occasionally a build would fail, and I would try to port the software on my own, with the idea of maybe submitting a package to Macports. But after a while I realized, “if I want to use Linux software, why not just use Linux?”

    So I bought a Netbook (Dell Inspiron Mini 10) with Ubuntu pre-installed. I really loved that little computer, I used it for a good 5 years until I needed a more powerful computer. I still have it, actually. I never went back to Apple until this year when I took a new job where they wanted me to use a MacBook Pro. (Again, not using proprietary software unless I am well paid.)

    I can say with confidence that Linux is considerably better than Apple’s operating systems. I use Aarch64 Debian 12.5 in a QEMU on that MacBook for most things, only switching over to Mac OS when I really need to.


  • Ramin Honary@lemmy.mltoLinux@lemmy.mlOpenSUSE is the best
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 months ago

    Never tried it, but everyone I know who has tried it says its the most stable rolling release OS ever. That is pretty cool. Btrfs support is cool too, copy-on-write, deduplication, and whole-disk snapshot and rollback capability, its great for keeping your data safe.

    I don't care about rolling releases, I get my stability from Debian, or sometimes Mint. If I want the latest software I’ll install Guix packages or FlatPaks. And I can still use Btrfs on Debian.


  • Ramin Honary@lemmy.mltoLinux@lemmy.mlNot really sure I get Wayland
    link
    fedilink
    English
    arrow-up
    97
    arrow-down
    1
    ·
    edit-2
    2 months ago

    I can explain the difference between X11 and Xorg with an analogy to the web and web browsers: X11 is like HTTP, Xorg is like the Chrome browser. X11 is the protocol, Xorg is software that implements that protocol.

    X11 is old, it was designed back in the 1980s and includes messages for drawing lines and circles and fonts on the screen. Also, back then there were a lot of “thin clients”, computers that were basically nothing but a browser, since graphics were computationally expensive and could not be done on the client computer, graphics rendering was done server side. There are lots of messages in the protocol for handling screen updates over a computer network.

    Nowadays, all personal computers are powerful enough to render their own graphics, and no one needs the display server to draw individual lines or circles on screen. Vector graphics and fonts are done at the application level, not over the network. So these these messages specified in the X11 protocol are hardly ever used. Really, most of X11 (let’s say 90% of it) is not used at all, only the parts where the keyboard and mouse are defined, and how you can allocate memory to buffer a graphic and copy that buffer to the display. But you still need to maintain the Xorg software to handle everything that X11 specifies, and this is just a waste of code, and a waste of time for the code maintainers.

    So basically, they decided about 10-15 years ago that since no one uses most of X11, let’s just define a new protocol (called Wayland) that only has the parts of X11 that everyone still uses, and get rid of the 90% of it that no one ever uses. Also, the protocol design takes into account the fact that most modern computers do all of their own rendering rather than calling out to a server to render for them. Also the Wayland protocol design takes into account that a lot of computers have graphics cards for accelerated graphics rendering.

    Since the Wayland protocol is much simpler, it is easier for anyone to write their own software which implements the protocol, these software are called “compositors.” Finally, 10 years after some of the first implementations of Wayland, the protocol and compositors are becoming mature enough that they can be used in ordinary consumer PCs.


  • Emacs.

    Emacs is an app platform in and of itself, and the vanilla installation comes with dozens of its own apps pre-installed. Like how web apps are all programmed in JavaScript, Emacs apps are all programmed in Lisp. All Emacs apps are scriptable and composable in Lisp. Unlike on the web, Emacs encourages you to script your apps to automate things yourself.

    Emacs apps are all text based, so they all work equally well in both the GUI and the terminal.

    Emacs comes with the following apps pre-installed:

    • a text editor for both prose and computer code
    • note taking and organizer called Org-mode (sort of like Obsidian, or Logseq)
    • a file browser and batch file renamer called Dired
    • a CLI console and terminal emulator
    • a terminal multiplexer (sort-of like “Tmux”)
    • a process manager (sort-of like “Htop”)
    • a simple HTML-only web browser
    • man-page and info page browser
    • a wrapper around the Grep and Find CLI tools
    • a wrapper around SSH called “Tramp”
    • e-mail client
    • IRC client
    • revion control system, including a Git porcelain called “Magit”
    • a “diff” tool
    • ASCII art drawing program
    • keystroke recorder and playback

    Some apps that I install into Emacs include:

    • “Mastodon.el” Mastodon client
    • “Elfeed” RSS feed reader
    • “consult” app launcher (sort-of like “Dmenu”)

  • Awk is a programming language designed for reading files line by line. It finds lines by a pattern and then runs an action on that line if the pattern matches. You can easily write a 1-line program on the command line and ask Awk to run that 1-line program on a file. Here is a program to count the number of “comment” lines in a script:

    awk 'BEGIN{comment_count=0;} /^[[:space:]]*[#]/{comment_count++;} END{print(comment_count);}' file.sh
    

    It is a good way to inspect the content of files, espcially log files or CSV files. But Awk can do some fairly complex file editing operations as well, like collating multiple files. It is a complete programming language.

    Sed works similar to Awk, but it is much simplified, and designed mostly around CLI usage. The pattern language is similar to Awk, but the commands are usually just one or two letters representing actions like “print the line” or “copy the line to the in-memory buffer” or “dump the in-memory buffer to output.”


  • Whenever I open the symlink, does the software (player) understand «oh this file seems like a symlink, I should go and open the original file», or it’s a filesystem level stuff and software (player) basically has no idea if a file I’m opening is a symlink or the original movie.mp4?

    Others have answered well already, I just will say that symlinks work at the filesystem level, but the operating system is specially programmed to work with them. When a program asks the operating system to open a file at a given path, the OS will automatically “reference” the link, meaning it will detect a symlink and jump to the place where the symlink is pointing.

    A program may choose to inspect whether a file is a symlink or not. By default, when a program opens a file, it simply allows the operating system to reference the file path for it.

    But some apps that work on directories and files together (like “find”, “tar”, “zip”, or “git”) do need to worry about symlinks, and will check if a path is a symlink before deciding whether to reference it. For example, you can ask the “find” command to list only symlinks without referencing them: find -type l


  • They do! /bin has the executables, and /usr/share has everything else.

    Apps and executables are similar but separate things. An app is concept used in GUI desktop environments. They are a user-friendly front end to one or more executable in /usr/bin that is presented by the desktop environment (or app launcher) as a single thing. On Linux these apps are usually defined in a .desktop file. The apps installed by the Linux distribution’s package manager are typically in /usr/share/applications, and each one points to one of the executables in /usr/bin or /usr/libexec. You could even have two different “apps” launch a single executable, but each one using different CLI arguments to give the appearance of different apps.

    The desktop environment you use might be reconfigured to display apps from multiple sources. You might also install apps from FlatHub, Lutris, Nix, Guix, or any of several other package managers. This is analogous to how in the CLI you need to set the “PATH” environment variable. If everything is configured properly (and that is not always the case), your desktop environment will show apps from all of these sources collected in the app launcher. Sometimes you have the same app installed by multiple sources, and you might wonder “why does Gnome shell show me OpenTTD twice?”

    For end users who install apps from multiple other sources besides the default app store, there is no easy solution, no one agreed-upon algorithm to keep things easy. Windows, Mac OS, and Android all have the same problem. But I have always felt that Linux (especially Guix OS) has the best solution, which is automated package management.


  • I don’t understand this guy’s argument at all. First of all, he isn’t using any shell that I know about, he seems to have invented his own, and the command line arguments he uses are specific to his own shell. He doesn’t explain how these command line arguments work in terms of POSIX system calls, so I can’t follow along with what he is actually doing. As far as I can tell, these are security issues with his own software, not with Unix or Linux.

    If you are worried about file mutability, you can use ZFS or BTrFS or BCacheFS. All of these filesystems have a snapshot function, so if any changes (e.g. file encryption by ransomware attackers) are made you can reboot and roll back the changes, unless the attackers figure out a way to get root access and delete your snapshots. But if an attacker has gained root access to your computer, that is a much more serious issue and not really in the scope of filesystem security or file mutability.

    The snapshot and rollback feature also exists in NixOS and GuixOS, where your operating system kernel and all software installed is part of a snapshot that can be rolled back, if the system becomes unbootable, you can rollback from within the GRUB boot loader. Again, all software installation is managed by a service that runs for you at root level so you never need sudo to install software, and the software you install never effects any other user or the operating system. So the only way to hack this is to gain root access and alter the content of the Guix or Nix “store” database with malicious code, but again, root access is a much bigger issue than what we are talking about.

    So yeah, the argument stated in this video makes no sense to me.



  • Ramin Honary@lemmy.mltoLinux@lemmy.ml/run/user/1000: What to do with it?
    link
    fedilink
    English
    arrow-up
    10
    arrow-down
    2
    ·
    edit-2
    7 months ago

    @[email protected] the /run/user/1000 directory is an in-memory file system of a fairly small size. The operating system creates it for you to store certain things that are for your user account only. The permission settings on this directory forbid any other user on the system (except for “root”) to see what is inside. This makes it safe to store secret information that only you should know.

    One typical example of something stored in this directory would be your plain text (unencrypted) password database if you use a password manager. No other user but you (and “root”) can see it, and it is in-memory only so it is not accidentally copied to your persistent memory (HDD or SSD disk drive) where it might be removed and read by hackers if someone steals your computer from you. At the same time, any program running on the system that was launched by you and only you has access to your passwords so you don’t need to remember passwords for everything. (Actually it is a socket to a server containing your unencrypted password database in memory, it is probably not actually a file in that directory.)

    Other things that go in this /run/user/1000 directory are socket connections to the desktop bus (allows for things like copy-and-paste or drag-and-drop to work between programs), socket connections to your audio mixer (allows you do things like to listen to music and do video chat at the same time), and a record of what external media devices you have connected to the computer which you are using via GVFS, and so on.

    Also, the number 1000 is your user ID number assigned to you by the operating system. If you create other accounts, they will have ID 1001, 1002, and so on, and each of them will have a directory with that number created in the /run/user directory for them when they login.




  • Ramin Honary@lemmy.mltoLinux@lemmy.mlNetBSD - thoughts?
    link
    fedilink
    English
    arrow-up
    43
    arrow-down
    1
    ·
    edit-2
    7 months ago

    Yes, it is mostly appliances, but an (informal?) stated goal of NetBSD is too run on all computing hardware.

    • FreeBSD = user-friendly free Unix (plus ZFS and jails 😀)
    • OpenBSD = very secure free Unix (no ZFS 🙁 but has the VMM hypervisor 😀)
    • OpenIndiana = user-friendly free Unix that runs old Solaris software (plus ZFS and zones 😀)
    • NetBSD = runs on any computer chip ever built within the past 40 years (some ZFS support, but no zones, jails, or VMs 🙁)

    Naturally, that makes NetBSD a good choice for appliances, especially ones that might only have limited memory.

    (Here is a quick explainer on the difference between Jails, Zones, Containers, and VMs)

    EDIT1: someone pointed out to me that ZFS is not supported on OpenBSD. Sorry about that everyone.

    EDIT2: there is a ZFS driver for NetBSD



  • I am also going to recommend the same solution as @[email protected] in this comment: https://lemmy.ml/comment/7998407

    You can create a key pair that is specifically just for this kind of backup transaction.

    To limit its affects, create a user and group on each of the devices that are highly restricted.

    This is actually the most secure solution that doesn’t require an interactive password prompt. The passwordless key only serves this one purpose and has small attack surface.

    Basically, you can tell SSH to allow root login on certain devices by setting up a root key pair. You configure SSH on the target device such that when it logs in, the login must run a script or a single command instead of running a shell, this limits what attackers can do if they somehow steal your private keys. You can also keep these private keys in your SSH agent so you only have to enter their passwords once, this will allow you to run remote commands without a password.

    I would recommend also exploring the possibility of setting up an Rsync Daemon on each remote device, it keeps an Rsync process running on a remote device and listens for connections from Rsync clients. https://linuxconfig.org/how-to-setup-the-rsync-daemon-on-linux

    On an unrelated topic: you might also want to look into using Btrfs and making and transferring snapshots to other devices.


  • Someone with more expertise can correct me if I am wrong, but the last I heard about this, I heard that cluster computing was obsoleted by modern IaaS and cloud computing technology.

    For example, the Xen project provides Unikernels as part of their Xen Cloud product. The unikernel is (as I understand it) basically a tiny guest operating system that statically links to a programming language runtime or virtual machine. So the Xen guest boots up a single executable program composed of the programming language runtime environment (like the Java virtual machine) statically linked to the unikernel, and then runs whatever high-level programming language that the virtual machine supports, like Java, C#, Python, Erlang, what have you.

    The reason for this is if you skip running Linux altogether, even a tiny Linux build like Alpine, and just boot directly into the virtual machine process, this tends to be a lot more memory efficient, and so you can fit more processes into the memory of a single physical compute node. Microsoft Azure does something similar (I think).

    To use it, basically you write a program a service in a programming language that runs on a VM and build it to run on a Xen unikernel. When you run the server, Xen allocates the computing resources for it and launches the executable program directly on the VM without an operating system, so the VM is, in effect, the operating system.