harsh3466

joined 2 years ago
[–] harsh3466@lemmy.world 1 points 1 month ago

With random journalists in the contacts.

[–] harsh3466@lemmy.world 95 points 1 month ago (10 children)

The FUTO guide is meant for total beginners.

[–] harsh3466@lemmy.world 2 points 1 month ago

Hahahaha! I had forgotten about that!

[–] harsh3466@lemmy.world 15 points 1 month ago (2 children)

I was using this to read put a gift card code to make a purchase over the phone with apple (don't ask why, it was a shit show), and when I gave Sierra, the person thought it was C as in Ciara. Had to repeat the whole thing over again.

[–] harsh3466@lemmy.world 0 points 2 years ago (1 children)

That, is awesome. I’d love to try printing one myself. I’m going to have to figure out where to start.

0
submitted 2 years ago* (last edited 2 years ago) by harsh3466@lemmy.world to c/linux@lemmy.ml
 

I've been reading Mastering Regular Expressions by Jeffrey E.F. Friedl, and since nobody in my life (aside from my wife) cares, I thought I’d share something I'm pretty proud of. My first set of regular expressions, that I wrote myself to manipulate the text I'm working with.

What’s I’m so happy about is that I wrote these expressions. I understand exactly what they do and the purpose of each character in each expression.

I've used regex in the past. Stuff cobbled together from stack overflow, but I never really understood how they worked or what the expressions meant, just that they did what I needed them to do at the time.

I'm only about 10% of the way through the book, but already I understand so much more than I ever did about regex (I also recognize I have a lot to learn).

I wrote the expressions to be used with egrep and sed to generate and clean up a list of filenames pulled out of tarballs. (movies I've ripped from my DVD collection and tarballed to archive them).

The first expression I wrote was this one used with tar and egrep to list the files in the tarball and get just the name of the video file:

tar -tzvf file.tar.gz | egrep -o '\/[^/]*\.m(kv|p4)' > movielist

Which gives me a list of movies of which this is an example:

/The.Hunger.Games.(2012).[tmdbid-70160].mp4

Then I used sed with the expression groups to remove:

  • the leading forward slash
  • Everything from .[ to the end
  • All of the periods in between words

And the last expression checks for one or more spaces and replaces them with a single space.

This is the full sed command:

sed -Eie 's/^\///; s/\.\[[a-z]+-[0-9]+\]\.m(p4|kv)//; s/[^a-zA-Z0-9\(\)&-]/ /g; s/ +/ /g' movielist

Which leaves me with a pretty list of movies that looks like this:

The Hunger Games (2012)

I'm sure this could be done more elegantly, and I'm happy for any feedback on how to do that! For now, I'm just excited that I'm beginning to understand regex and how to use it!

Edit: fixed title so it didn’t say “regex expressions”

 

I just started listening to Lessons in Chemistry, and so far it’s excellent. It’s also depressing. I (a mostly cishet male), know cognitively that women have faced horrific treatment and discrimination for thousands of years. So far, the writing in Lessons in Chemistry is very good at making something I know as a fact feel very visceral.

That’s a good thing, and I hope many men read this and experience it in a similar way as I am, though I fear the sorts of men that need to experience this are not the sort of men that are likely to read this book.

[–] harsh3466@lemmy.world 1 points 2 years ago (1 children)

Yes! Damn that was a good episode.

Also. How did you do the spoiler tag?

[–] harsh3466@lemmy.world 1 points 2 years ago* (last edited 2 years ago) (3 children)

Ay! I’m being gay ova here!

I loved this episode. Every story line had a great payoff, and my wife and I were laughing through the whole episode.

I especially enjoyed Nandor going to space. I loved how small and petty his motivation was (to impress Guillermo) and then his reaction when he was in space (how insignificant we all are) and then his crash back to earth. I’m laughing now thinking about it.

But the pièce de résistance was the very end scene with Lazlo banging Nadia-doll/Colin Robinson while Nadia (in doll body) encouraged/whipped him. That scene was absolutely amazing.