HNHacker News
TopNewBestAskShowJobs

drbaba

104 karma · joined April 19, 2023

submissionscomments
drbaba··on Contour: Modern and fast terminal emulator
Mainly the native feel. For example, you can use standard Cmd-based keybindings to control tabs and panes, and get smooth mouse scrolling in each pane.
drbaba··on Contour: Modern and fast terminal emulator
Many interpreters don’t use Readline (e.g. IPython and Zsh), and enabling inconsistent Vi keybinsings in each one can be a bit annoying. From that perspective, adding it to the terminal seems a possibly easier way to get it “everywhere”?
drbaba··on Pkgx – “Run anything” from the creator of brew
Do you have a link to where I can read about using Nix as purely a package manager? Or a minimal example showing how a Nix config looks if used in this manner?
drbaba··on Pkgx – “Run anything” from the creator of brew
> It's strange that people are so against declarative systems, or even file-based OS configuration. When I get my new Macbook I was up-and-running within a few minutes. I can't imagine maintaining a list of brews I need to re-install just to set up everything + my configs + everything else.

I haven’t had time to try Nix yet, but HomeBrew does have a declarative-ish workflow that I’ve been using for years:

Brew Bundle [1] lets you have a plaintext file listing all packages you want installed on your system. Add a line for stuff you want installed, delete a line for stuff you want removed, invoke it the right way and it will install/remove packages until your system matches the list. The initial list can be generated by “brew bundle dump” or something like that.

For configuration, I find that a normal dotfile repo cloned into my ~/.config (with a script that maintains symlinks to config files in e.g. ~/Library) works well enough for my use.

[1]: https://github.com/Homebrew/homebrew-bundle

drbaba··on Python 3.12
Modern Fortran (2008+) has built-in support for matrices, complex numbers, co-arrays (parallel programming), array slicing, etc. This makes it easy to write performant compiled code if you mostly deal with numerics.

Fortran has also added support for e.g. object-oriented programming, pure functions (no side effects for better optimization), and pointers. So idiomatic modern Fortran code looks very different from the “Fortran 77” code that many people might think of when they hear the name :).

drbaba··on Android 14 adds support for using your smartphone as a webcam
Apple already did introduce this for iOS 1-2 years ago (assuming you have an iPhone and a Mac). I know because I’ve activated the feature by accident a few times.
drbaba··on LaTeX for tabletop
Personally, I find the Overleaf web editor to be worse than a local editor (even with Vim keybindings, dark theme, etc.)

But if your organization pays for Overleaf, you can sync Overleaf projects to local Git repos - and just pull / push as you would any other Git repo.

This is the best of both worlds IMO, since collaborators that don’t know Git can use the web editor without prior knowledge, while collaborators with strong opinions about editors usually know Git (or are willing to learn it).

There is also a Dropbox sync option, but I don’t recommend it. I’ve experienced bugs several times where TeX files suddenly become empty when using it.

drbaba··on micro – A Modern Alternative to nano
> I really wish other editors would follow this convention.

In editors with configurable keyboard shortcuts, you can bind this to tab yourself. For example, in Vim, the normal-mode command `==` would correctly reindent the current line. (Here, `=` is an operator, so you can also apply it to other regions like `=i{` to reindent correctly everything inside braces.)

To bind tab to reindent correctly in normal and visual mode, you can put this in your vimrc:

    nnoremap <tab> ==
    vnoremap <tab> =
You can also remap it in insert mode if you want, but then you might want to throw some if-statements in there to determine when to indent and when to reindent :)
drbaba··on micro – A Modern Alternative to nano
I'm more in the Vim camp myself, but suspect that those who use nano for longer programming sessions do so using a well-crafted nanorc. Nano does support some "modern" features like syntax highlighting, it's turned just off by default. (As far as I know, you won't be getting stuff like LSP and multiple cursors though.)
drbaba··on Teach a man to phish and he’s set for life
Mathematicians usually write papers in LaTeX, which predates Unicode and doesn’t rely on it. You then just type \pi in a math context and get the right symbol. (Though here are modern LaTeX implementations that support Unicode input as well.)
drbaba··on Nim 2.0
Following up on this: As someone who uses Python with NumPy/SciPy heavily, are there any Nim libraries that would make the transition smooth? Libraries that can help with e.g. sparse matrices, linear algebra, differential equations, etc.
drbaba··on LK-99: The live online race for a room-temperature superconductor
Note that “bulk” in this context means a single large chunk, not a large quanitity.
drbaba··on The first room-temperature ambient-pressure superconductor?
> What, exactly, are the "world changing" applications?

Superconducting computing is a big one - even if we stick to classical computers (i.e. not quantum computers), there are estimates that superconducting computers could be ~1000x more energy efficient than state-of-the-art semiconductor computers.

drbaba··on How does iCloud work? Plus a new version of Cirrus
> why on earth are you using iCloud to sync photos

Some reasons for me personally:

- It works well enough. I rarely have issues (maybe once a year as you say?), and then it’s usually resolved by a device reboot. Once I had to turn iCloud sync on and off again. However, I’ve learned to avoid e.g. working on Git repos in iCloud Drive, which tends to upset the sync process.

- It’s cheap. I can get 200GB storage shared with family for €3.5/month. For example Dropbox doesn’t sell less than 2TB plans, which with family sharing becomes €17/month. That’s 5x more.

- It is the best alternative on iOS. I tried lots of other sync apps before I migrated to iCloud. Partly, this is because Apple has crippled the competition by not allowing them to sync in the background without battery-draining hacks, not allowing them to integrate directly with the Photos app, etc. Partly it is because the other cloud providers I tried didn’t integrate properly with e.g. the Files API.

drbaba··on JetBrains Mono Typeface
I initially liked them, but later changed my mind. The same goes for e.g. prettify-symbols-mode in Emacs or conceal in Vim, which takes the same concept further.

I often work with files (both documents and code) where Unicode input is permitted, and it can then be important to know what exactly is written in the file. Fancy ligatures make this ambiguous.

I would also advise against ligatures in terminals, as it can mess up some text-based interfaces.

drbaba··on Numbering Should Start at Zero
> Computing the bounded index from an arbitrary index is simply i % c with zero based indexing, but becomes (i-1) % c + 1 with one based indexing.

Arguably, this is because the common definition of modular arithmetic is itself zero-based: “modulo N” maps all integers into the numbers [0,N-1]. It is fully possible to define a “%” operator that instead mapped the integers into the range [1,N], which might be more natural in 1-based languages?

drbaba··on Numbering Should Start at Zero
> If you have a two dimensional array A (1..N X 1..M), then flattening it becomes A[i][j] = flat[i + (j-1) * N]

> When flattening A (0..N-1 X 0..M-1) A[i][j] becomes flat[i + N * j].

To play the devil’s advocate a bit: Both cases above has the same number of “-1” offsets; the question is whether it is in the indexing or in the bounds. In the 0-indexed case, i goes from 0 to N-1 instead of from 1 to N, and this happens for every array dimension.

drbaba··on Filenames and pathnames in shell: How to do it correctly (2020)
> well, except for the fact that MacOS defaults to zsh now.

But Zsh is also POSIX sh compatible, is it not?

drbaba··on “Tipflation” may be causing backlash as more digital prompts ask for tips
If one business excludes tax from the price while every other business includes it, that’s misleading advertisement. I think writing the full price to be paid by the customer should be mandated by law, in which case no business gets a relative advantage over any other.

Where I live, we go even further: if you offer a subscription with a binding period, you also have to write the minimum total amount to be paid by the customer before they can cancel the subscription.

This helps prevent customers into getting tricked into spending more money than they can really afford, which is a good thing?

drbaba··on “Tipflation” may be causing backlash as more digital prompts ask for tips
> But imagine you're a small business, and you price the croissants you've just spent hours making at €1 each and you know you'll only get €0.79 of that. It feels unfair.

Then price the croissant at €1.25 instead? The US method would still make the customer pay that amount; the only difference is whether the math is done once by the seller or every 10min by a new customer.

drbaba··on Moving fast with the core Vim motions
I wonder how it would be if one attempted to make Vim’s verb-object system more visual instead? Imagine if say “dwww” would highlight the next three words in red to mark them for deletion - but until you press enter to execute the deletion, you remain in a visual-like mode where you can adjust the region you want to delete by pressing more motion keys. Similarly, pressing “yip}” could highlight two paragraph (in paragraph + next paragraph) in yellow and then yank them when you press enter.

This would kinda be the opposite of the idea in Helix/Kakoune: one automatically enters a visual-mode-like state after typing a verb that expects an object.

drbaba··on Moving fast with the core Vim motions
> Another issue is that commands are utterly unergonomic, requiring lots of rapid Shift presses/releases

Curious. Unergonomic compared to what? Given your comment about separating commands and input language, I assume you’re using a non-modal editor, which usually rely more on modifiers than Vim.

Personally, I haven’t found any ergonomic non-modal editor, where I by “ergonomic” mean no RSI pain even after heavy usage. For me, the fact that editing in Vim is comfortable is its main selling point (more so than its speed).

> mistakes can lead to destructive consequences

I do often make mistakes, but I can’t remember the last time I accidentally did something so destructive in Vim that I couldn’t just undo it normally.

drbaba··on Moving fast with the core Vim motions
Not to detract from your general point - I definitely see the value in using an IDE with a Vim plugin, and often do so myself.

> Vertical scrollbar? Plugin

If you want scrollbars, the right solution is IMO to use a GUI Vim. I often use MacVim which is great, GVim is the obvious alternative on Linux/Windows, and NeoVim has lots of options (including, arguably, VSCode-NeoVim which is also great).

With MacVim, I can pop around randomly in a terminal and open Vim instances that run in the terminal as usual - and if I start editing something for long, I can type :gui to pop up an actual MacVim GUI window. I believe the same works in GVim.

> * Autocomplete code using lsp? Dance with plugins or copy paste literal screens of configs for nvim

I was annoyed by this as well. I then discovered that ALE (the venerable pre-LSP plugin for async linting) now has full LSP support, and it all “just works”. Doesn’t require NeoVim either. Just install the ALE plugin and put LSP servers in $PATH. ALE will find and use them. (By default, it uses standard Vim bindings like C-x C-o for completion, but you can change it.)

> * Want nice looking theme? Plugin! (Gruvbox in my case)

Vim 9.x (not NeoVim) has added a built-in Gruvbox theme named “retrobox” (both light and dark variants based on your background setting). If you don’t have it yet, you can get it as a plugin from here until your Vim updates: https://github.com/vim/colorschemes

> * Wrap long lines by whole words if possible? No default setting, I guess I need to search for plugin for that too.

There are built-in settings for this, but yeah it requires some initial fiddling to get it nice. (After that initial fiddling, I’ve been annoyed by how word wrap works in any other editor.)

drbaba··on Moving fast with the core Vim motions
Also, if you’re not bound to using Vim without plugins, then the CleverF plugin lets you repeat with f/F instead of ;/,

It’s IMO easier to hit f again than to reach for the semicolon, and moreover this frees ; and , for usage in your own mappings (e.g. leader and localleader)

drbaba··on Show HN: A smarter Unix shell and scripting environment
> once the functionality missing gets apparent enough on a constant basis as it happened for me when switching from fish to zsh.

As someone that went the other way ~5 years ago, I’m curious what made you switch :). Are you btw on a hand-rolled config or one of the distributions?

(For me, it was that I was maintaining a ~400 line zsh config, and then learned that fish did most of the things I had configured “out of the box”. I considered switching back for increased POSIX compatibility since I often write bash scripts at work, but since Fish 3 added POSIX-compatible syntax for most pain points, I haven’t kept up with zsh.)

drbaba··on Grocery Mergers? Not So Good
Maybe progressive taxation of companies, where they pay more tax the larger they become?
drbaba··on Vitamin D: Potent regulator of dopaminergic neuron differentiation and function
My understanding is that the main correlation between sunlight and skin cancer is for sudden exposure to strong sun. If you go outside all year without sunblock (as people used to do back in the day), and thus build up and maintain a natural tan, the cancer risk is very low. But if you sit inside all year and then suddenly go to the beach,l in July, the risk increases.
drbaba··on I didn’t learn Unix by reading all the manpages (2022)
They are, but my impression is that only Emacs users use them to some extent. (Emacs has a built-in info reader that is better than the standalone client, and ships mainly info pages as its documentation.) Outside of Emacs, I’d say very few people know info is even a thing, and I remember some Linux distributions also stripped info pages from packages since everyone used man pages.
drbaba··on SciPy: Interested in adopting PRIMA, but little appetite for more Fortran code
I used Fortran 2008 a lot some years ago; initially I wanted to write a C++ wrapper around a Fortran library that seemed useful, but ended up liking the language better than C++ and just did the whole project in it.

I think a lot of people don’t realize that modern Fortran actually supports object-oriented programming and Matlab-style array slicing, and comes with built-in support for e.g. matrices and complex numbers. It even has some features inspired by functional languages, like being able to mark functions as pure (side-effect free). Combined with its general speed, this makes it a pretty nice language for numerical code.

Although for most new users, I think Julia might be a better option than Fortran these days.

drbaba··on Are We Sixel Yet
> My terminal (iTerm2) doesn't give me the full power to manipulate windows/panels using shortcuts.

Which tmux pane management features do you miss in iTerm2?

← PreviousPage 2 of 3Next →