hallettj

joined 4 months ago
[–] hallettj@leminal.space 12 points 1 week ago

There was a post earlier today complaining about questions that aren't open-ended, and therefore don't adhere to the community rules. So here we are with a question with many possible answers (which makes it properly open-ended).

[–] hallettj@leminal.space 3 points 2 weeks ago

To start the firewall after you stopped it:

sudo systemctl start firewalld

systemctl is part of systemd - it starts and stops various services, shows statuses, lists available services, etc.

There is documentation on opening ports here, plus more details on enabling & disabling the firewall: https://docs.fedoraproject.org/en-US/quick-docs/firewalld/#_controlling_ports_using_firewalld

[–] hallettj@leminal.space 6 points 2 weeks ago

Probably not directly helpful, but Nix packages for Chromium and Electron apps are set up so that you can switch to native Wayland mode globally by setting an environment variable, NIXOS_OZONE_WL=1

I don't know of any global setting that isn't distro-specific.

[–] hallettj@leminal.space 6 points 2 weeks ago (1 children)

That's a different form

[–] hallettj@leminal.space 2 points 3 weeks ago

The artificial sounds are legally required at low speeds, at least in the US and Europe. In the US electronic sounds are required at speeds below 30 kph. In the EU I think it's 20 kph. At faster speeds the sounds of wheels on the road and such make electric and hybrid cars basically as loud as ICE cars.

There are very specific rules about the noises. It looks like there was some effort in the US to allow user-selectable sounds, but it didn't work out. I found some info here, https://www.federalregister.gov/documents/2022/07/13/2022-14733/federal-motor-vehicle-safety-standards-minimum-sound-requirements-for-hybrid-and-electric-vehicles

[–] hallettj@leminal.space 1 points 4 weeks ago (1 children)

It could be good, but there is a conflict with one of the electric car hurdles: range anxiety. I use a level 1 charger at home which works fine for regular use - but it does take about 4 days to charge a nearly-depleted battery up to 80%. I'd be loath to give up energy that takes such a long time to get back. But this system would presumably require a level 2 charger, and that might make it ok. Still I can imagine objections over not having a car charged when you want to make a longer, last-minute trip, and over battery depreciation due to more cycling.

[–] hallettj@leminal.space 1 points 1 month ago

This seems like the right answer to me. Whether or not you decide to dual boot, make one of these USB keys so you can recover if something goes wrong.

[–] hallettj@leminal.space 3 points 1 month ago

When I was using Debian I found I could generally get the latest version of software I wanted from Nix if it wasn't in the main Debian repos, or was outdated. Nix works quite well on any Linux distro - it doesn't interfere with the rest of the system.

[–] hallettj@leminal.space 3 points 1 month ago

All I can tell you is that this is done differently for each shell. So decide whether you want completions for bash, zsh, fish, all of the above, or whatever, and look at the docs for the relevant shells.

[–] hallettj@leminal.space 2 points 1 month ago

There are other galaxy clusters. Gravitational binding is not unique to the local cluster. From Wikipedia,

Notable galaxy clusters in the relatively nearby Universe include the Virgo Cluster, Fornax Cluster, Hercules Cluster, and the Coma Cluster.

The expansion of the universe is very tricky to explain. Oversimplifying can lead to an explanation that seems to be contradictory.

[–] hallettj@leminal.space 1 points 1 month ago

I think this is good advice. Don't over-think it!

[–] hallettj@leminal.space 15 points 1 month ago

I've often thought that the people working on herpes treatments probably don't get the credit they deserve

 

I installed StarCraft: Mass Recall which is an impressive project that recreates the original StarCraft and Brood War campaigns in StarCraft 2. Everything works except that the cinematics and some of the game assets are flat, blank red. For example some of the video portraits in the briefing rooms display correctly, but Mengsk is a solid red square. In the first mission Raynor's vulture is flat red while everything else looks correct. Sound works correctly including in cinematics.

The game assets aren't a huge deal, but the cinematics are a big part of the reason for playing these campaigns IMO.

I've tried everything I can think of. I tried some different Wine runners. I tried disabling DXVK. I installed a number of dependencies that look like they provide video codecs:

  • amstream
  • devenum
  • quartz
  • xvid
  • ffdshow

Does anyone have ideas about what else I might try?

What I did figure out is a working command to run the mod, which took me a while. I used Bottles, installed Battle.net through the Bottles program installer, installed StarCraft 2 via Battle.net, and finally installed Mass Recall by unzipping and copying its files to the StarCraft Maps/ and Mods/ directories. Then I was able to run Mass Recall with this command:

$ bottles-cli shell -b "<bottle name>" -i '"C:\Program Files (x86)\StarCraft II\Support64\SC2Switcher_x64.exe" "C:\Program Files (x86)\StarCraft II\Maps\Starcraft Mass Recall\SCMR Campaign Launcher.SC2Map"'
 

cross-posted from: https://leminal.space/post/4750886

It took me some time to work out how to get my ssh agent set up in Niri so I though I would share what I did. I'm using NixOS and Home Manager. I put this in my Home Manager config:

services.gnome-keyring = {
  enable = true;
  components = [ "pkcs11" "secrets" "ssh" ];
};
home.sessionVariables.SSH_AUTH_SOCK = "$XDG_RUNTIME_DIR/keyring/ssh";

I'm using GDM according to NixOS' default configuration which I think runs gnome-keyring (I thought I saw it in the process list before I set up the user unit), and I think that configuration is automatically unlocking gnome-keyring when I log in via PAM integration. But apparently I need to run gnome-keyring again in my window manager session. Home Manager's services.gnome-keyring adds a systemd user unit that does that.

11
submitted 4 months ago* (last edited 4 months ago) by hallettj@leminal.space to c/neovim@programming.dev
 

I'd like a treesitter query that matches a Rust struct together with all of its attributes. For example,

#[derive(Debug)]
#[serde(rename_all = "camel_case")]
pub struct MyType {
    pub foo: i32,
}

The lines beginning with # are attributes that are logically connected to the struct declaration. But the treesitter grammar for Rust parses attributes as adjacent nodes, not as children of the struct declaration:

  (attribute_item ; [27, 0] - [27, 16]
    (attribute ; [27, 2] - [27, 15]
      (identifier) ; [27, 2] - [27, 8]
      arguments: (token_tree ; [27, 8] - [27, 15]
        (identifier)))) ; [27, 9] - [27, 14]
  (attribute_item ; [28, 0] - [28, 35]
    (attribute ; [28, 2] - [28, 34]
      (identifier) ; [28, 2] - [28, 7]
      arguments: (token_tree ; [28, 7] - [28, 34]
        (identifier) ; [28, 8] - [28, 18]
        (string_literal)))) ; [28, 21] - [28, 33]
  (struct_item ; [29, 0] - [31, 1]
    (visibility_modifier) ; [29, 0] - [29, 3]
    name: (type_identifier) ; [29, 11] - [29, 17]
    body: (field_declaration_list ; [29, 18] - [31, 1]
      (field_declaration ; [30, 4] - [30, 16]
        (visibility_modifier) ; [30, 4] - [30, 7]
        name: (field_identifier) ; [30, 8] - [30, 11]
        type: (primitive_type)))) ; [30, 13] - [30, 16]

How can I get produce a query that I can use in mini.ai that matches the struct, and all attributes?

I've tried this query using Neovim's new built-in :EditQuery command:

((attribute_item)* . (struct_item)) @custom_capture.outer

It looks like it does what I want. But when I try using @custom_capture.outer in mini.ai it matches the struct declaration, but not the attributes.

I tried using #make-range! like this,

((attribute_item)* @_start . (struct_item) @_end
  (#make-range! "custom_capture.outer" @_start @_end))

That matches the struct and the second attribute, but does not get the first attribute. I'm guessing that's because the . specifies that nodes must be adjacent, and the second attribute is the only one that is adjacent to a struct_item. Following that thinking I tried this,

((attribute_item)? @_start . (attribute_item)* . (struct_item) @_end
  (#make-range! "custom_capture.outer" @_start @_end))

That gets the struct and all the attributes, but only if my cursor is on the first attribute line when I use the textobject. If my cursor is on any subsequent line then I get the second attribute and the struct, but the first attribute is missed.

One problem is I'm not clear whether ((attribute_item) . (struct_item)) matches an attribute_item and a struct_item that are adjacent, or matches an attribute_item that precedes a struct_item, but does not also match the struct_item. I tried experimenting with the second interpretation and used this query,

(((attribute_item) 
  . [(attribute_item) (struct_item)])* @_start
  (struct_item) @_end
  (#make-range! "custom_capture.outer" @_start @_end))

That captures what I want, but in some cases if I have two struct declarations and I try to match only the second one the query selects both structs instead.

Is that the way to do a lookahead? Or is there another way?

I've kinda hit a wall looking at documentation, other examples, and running my own experiments. Does anyone have any pointers to help understand these queries on a deeper level?

Edit: It looks like this stuff is in flux, so I should mention that I'm using the latest nightly as of March 2 2024, and I made sure that all of my plugins are up-to-date.

view more: next ›