[-] orsetto@lemmy.dbzer0.com 35 points 1 month ago

I'm almost sure the backstory to how you gained this knowledge is "i spent hours debugging something, and that 15 chars limit was the problem"

23
Help with sed commands (lemmy.dbzer0.com)
submitted 2 months ago* (last edited 2 months ago) by orsetto@lemmy.dbzer0.com to c/linux@lemmy.ml

Hi all! I have always only used sed with s///, becouse I've never been able to figure out how to properly make use of its full capabilities. Right now, I'm trying to filter the output of df -h --output=avail,source to only get the available space from /dev/dm-2 (let's ignore that I just realized df accepts a device as parameter, which clearly solves my problem).

This is the command I'm using, which works:

df -h --output=avail,source \
    | grep /dev/dm-2 \
    | sed -E 's/^[[:blank:]]*([0-9]+(G|M|K)).*$/\1/

However, it makes use of grep, and I'd like to get rid of it. So I've tried with a combiantion of t, T, //d and some other stuff, but onestly the output I get makes no sense to me, and I can't figure out what I should do instead.

In short, my question is: given the following output

$ df -h --output=avail,source 
Avail Filesystem
  87G /dev/dm-2
 1.6G tmpfs
  61K efivarfs
  10M dev
...

How do I only get 87G using only sed as a filter?

EDIT:

Nevermind, I've figured it out...

$ df -h --output=avail,source \
    | sed -E 's/^[[:blank:]]*([0-9]+(G|M|K))[[:blank:]]+(\/dev\/dm-2).*$/\1/; t; /.*/d'
85G
[-] orsetto@lemmy.dbzer0.com 17 points 5 months ago

If they keep raising my food subscription I'm gonna start pirating from supermarkets too

[-] orsetto@lemmy.dbzer0.com 34 points 8 months ago

This topic has been pinned, so it's probably important

66
Reject vim return to emacs (lemmy.dbzer0.com)

If you have typed an <ESC> by mistake, you can get rid of it with a C-g.

quoting the emacs tutorial. made me giggle

[-] orsetto@lemmy.dbzer0.com 27 points 10 months ago

Not an ad. No one is trying to sell you anything.

(If you get the notification) you're already using their product.

[-] orsetto@lemmy.dbzer0.com 137 points 1 year ago

I'd like to add this one:

Uhhuh. NMI received for unknown reason 31 on CPU 3.
Dazed and confused, but trying to continue

I get this one like once a week and it always makes me laugh. One day I'll investigate

[-] orsetto@lemmy.dbzer0.com 14 points 1 year ago

You can create a free account at first and then upgrade using bitcoin.

[-] orsetto@lemmy.dbzer0.com 39 points 1 year ago

That's what a fed in your position would say.

[-] orsetto@lemmy.dbzer0.com 100 points 2 years ago

Happened to me too. Best thing is going to therapy.

This might be caused by bigger problems with your family or work. Or it might just be accumulated stress unrelated to anything in particular.

Therapy helps either way

9
submitted 2 years ago* (last edited 2 years ago) by orsetto@lemmy.dbzer0.com to c/programming@programming.dev

Hi. I'm working on a project that compiles Rust code to WASM, and uses WASI in Node.js to execute it. After some development, I encountered a segmentation fault happening in the wasi.start() function. Considering that I'm kinda new to Node I was only able to understand that it was happening after the call to the exported WASM method returned.

This happened almost two months ago, and while I thought about reporting this to the node devs (WASI's also experimental), I was going to move soon and a lot has gone on.

Yesterday I tried to reproduce the bug on my laptop (that is not my usual development environment, which I don't have access to right now) but I wasn't able to.

I had to start fresh and install all the necessary tools from zero, so my theory is that there was something wrong in the previous environment. I'm also on Gentoo now, while I was running Arch previously.

Unfortunately I don't have the means to check on other environments. I tried to reproduce the old environment, installing the same versions of node and rust, with no luck. I also tested this with the latest versions and everything works fine.

This situation is upsetting. I don't know what's changed that caused the problem to "disappear", so i feel uncomfortable considering this solved. What would be the best approach in this situation?

EDIT: I also just tested it on Debian live, and I still wasn't able to reproduce the segfault

48
[-] orsetto@lemmy.dbzer0.com 33 points 2 years ago

Why do you say it's from the police?

[-] orsetto@lemmy.dbzer0.com 45 points 2 years ago

✨michael jackson✨

[-] orsetto@lemmy.dbzer0.com 18 points 2 years ago* (last edited 2 years ago)

Just finished Stirner's book, it's interesting. (although I do not agree with even half of the things he says)

Marx and Engels wrote about him in "The German Ideology", criticizing him harshly, but the book was only published after their death.

view more: next ›

orsetto

joined 2 years ago