[-] learnbyexample@programming.dev 2 points 2 years ago

Not my site, just sharing a link I saw on HN.

[-] learnbyexample@programming.dev 2 points 2 years ago* (last edited 2 years ago)

Here's a solution with perl (assuming you don't want to change http/https after the start of ( instead of start of a line):

perl -pe 's/\[[^]]+\]\(\K(?!https?)[^)]+(?=\))/lc $&=~s|%20|-|gr/ge' ip.txt
  • e flag allows you to use Perl code in the substitution portion.
  • \[[^]]+\]\(\K match square brackets and use \K to mark the start of matching portion (text before that won't be part of $&)
  • (?!https?) don't match if http or https is found
  • [^)]+(?=\)) match non ) characters and assert that ) is present after those characters
  • $&=~s|%20|-|gr change %20 to - for the matching portion found, the r flag is used to return the modified string instead of change $& itself
  • lc is a function to change text to lowercase
[-] learnbyexample@programming.dev 2 points 2 years ago

Check out my chapter on GNU grep BRE/ERE for those wanting to learn this regex flavor: https://learnbyexample.github.io/learn_gnugrep_ripgrep/breere-regular-expressions.html (there's also another chapter for PCRE)

[-] learnbyexample@programming.dev 2 points 2 years ago

Memory, Sorrow, and Thorn by Tad Williams

24
Python Resources for Everybody (learnbyexample.github.io)
38
22
119
16
10
26
The TTY demystified (www.linusakesson.net)
49
21
20
How stdbuf works (hmarr.com)
[-] learnbyexample@programming.dev 2 points 2 years ago

I'm not the site author, just submitting the link.

Not sure which part you need to be logged in to view - I'm seeing links to different articles and exercises and they are all visible without logging (I checked in an incognito window).

16
All About Decorators in Python (www.pythonmorsels.com)
53
[-] learnbyexample@programming.dev 2 points 2 years ago

Is it regex or sed/awk syntax (or both) that gives you trouble?

I had similar reaction and didn't even try to learn them for years - then I caught the stackoverflow craze of answering CLI questions (and learning from others).

[-] learnbyexample@programming.dev 2 points 3 years ago

magic is used and studied/understood like science

I haven't read Dungeon Crawler Carl yet, but that should fit your criteria right? Many of the progression fantasy books usually have a magic system with tangible tiers and usually rules are known too.

Cradle by Will Wight and Mage Errant by John Bierce are both complete series and I'd put their magic system as hard. Mage Errant dives deeper into the workings, especially as the main characters are students and one of their teachers is especially knowledgeable. Arcane Ascension by Andrew Rowe is another series with such academy focus and a progression magic system.

[-] learnbyexample@programming.dev 2 points 3 years ago

Finished The Magicians of Caprona (Chrestomanci, #4) by Diana Wynne Jones earlier today. It had the usual whimsical charm but the characters and plot took a while to get used to.

Haven't decided yet what I'll read next, but thinking of starting the "Harper Hall" trilogy. I read Dragonriders of Pern a few years back, don't remember much. Will be interesting to see if I'd enjoy Harper Hall, which IIRC was said to be more on the cozy side.

[-] learnbyexample@programming.dev 2 points 3 years ago

I use GVim for coding and text editing in general.

Programming wise, CLI tools (grep, sed, awk, sort, head, etc) are enough for most of my tasks. I've written a few Python TUI projects (uses Textual framework) but these are around 300-400 lines, so Vim is more than enough for my purposes. Don't even need any plugins.

[-] learnbyexample@programming.dev 2 points 3 years ago

That depends on the regex flavor. Some of them have full support for variable length lookbehinds, for example JavaScript and third-party regex module for Python.

[-] learnbyexample@programming.dev 2 points 3 years ago* (last edited 3 years ago)

The book is a 2023 Hugo finalist in the "Best Novel" category and the author is part of the "Astounding Award for Best New Writer" (https://file770.com/2023-hugo-finalists-2/)

It was one of my best reads last year and so happy that it popularized the cozy fantasy subgenre.

[-] learnbyexample@programming.dev 2 points 3 years ago

Can't reproduce your issue:

$ line='2023-06-19T00:00:00+01:00 2023-06-18T00:00:00+01:00 2023-06-17T00:00:00+01:00 2023-06-16T00:00:00+01:00 2023-06-15T00:00:00+01:00 2023-06-14T00:00:00+01:00 2023-06-13T00:00:00+01:00 2023-06-10T00:00:00+01:00 2023-06-03T00:00:00+01:00 2023-05-31T00:00:00+01:00 2023-05-27T00:00:00+01:00'
$ arr=( $line )
$ echo "${arr[4]}"
2023-06-15T00:00:00+01:00
view more: ‹ prev next ›

learnbyexample

0 post score
0 comment score
joined 3 years ago