There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

@learnbyexample@programming.dev avatar

learnbyexample

@[email protected]

Interests: Regular Expressions, Linux CLI one-liners, Scripting Languages and Vim

GitHub: github.com/learnbyexample

This profile is from a federated server and may be incomplete. Browse more on the original instance.

learnbyexample OP ,
@learnbyexample@programming.dev avatar

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 ,
@learnbyexample@programming.dev avatar

oxipng, pngquant and svgcleaner for optimizing images

auto-editor for removing silent portions from video recordings

learnbyexample OP ,
@learnbyexample@programming.dev avatar

What’s the difference between two_percent and skim?

learnbyexample OP ,
@learnbyexample@programming.dev avatar

I’m self-published and haven’t worked for other publications. Sometimes, my submissions reach HN front page, so you might have seen there or because others picked it up from there and shared around elsewhere.

learnbyexample OP ,
@learnbyexample@programming.dev avatar

You’re welcome, happy learning :)

learnbyexample OP ,
@learnbyexample@programming.dev avatar

Yeah, it is uncommon spelling, but if you google, you’ll find it’s not that rare ;)

learnbyexample OP ,
@learnbyexample@programming.dev avatar

As per the manual, “Mappings are set up to work like most click-and-type editors” - which is best suited with GUI Vim.

While Vim doesn’t make sense to use without the modes, there are plugins like github.com/tombh/novim-mode!

learnbyexample OP ,
@learnbyexample@programming.dev avatar

Thanks! 😊

learnbyexample OP ,
@learnbyexample@programming.dev avatar

Thanks a lot for the kind words! Means a lot to me :)

learnbyexample OP ,
@learnbyexample@programming.dev avatar

I had to learn Linux CLI tools, Vim and Perl at my very first job. Have a soft spot for Perl, despite not using it much these days other than occasional one-liners (mainly for advanced regex features).

learnbyexample ,
@learnbyexample@programming.dev avatar

I’m doing a beta-read. Well written, great ideas, etc. Unfortunately, the book is turning out to be much darker than I’m comfortable with. I’ll probably try to get to the halfway point before deciding to give up.

learnbyexample ,
@learnbyexample@programming.dev avatar

Like alpha, beta, gamma readers. Used by authors to get feedback at various stages of their book before it is published. Alpha stage is very rough, like first draft. Not sure where the line lies between beta and gamma stage, but they are close to finished works - only typos and minor changes would be made based on reader feedback.

For indie authors, beta readers often help to get a few reviews out close to book publication.

learnbyexample ,
@learnbyexample@programming.dev avatar

I’m a bit active on book-related forums. I post reviews of books I’ve read, give book recommendations, etc. In this case, the author contacted me based on my reviews.

learnbyexample ,
@learnbyexample@programming.dev avatar

Bobiverse by Dennis E. Taylor is a fun and easy read

learnbyexample ,
@learnbyexample@programming.dev avatar

+1 for Murderbot!

learnbyexample ,
@learnbyexample@programming.dev avatar

Stormlight Archives can be daunting to those not familiar with Sanderson’s works, especially since the books are long (1000+ pages) and the first book is setting up a long 10-book series (plus other stuff from a wider universe).

If you’d like something smaller and standalone to try first, check out “Emperor’s Soul” (novella) or Warbreaker (novel).

learnbyexample ,
@learnbyexample@programming.dev avatar

Hopefully less than this year. I’m reading too many (100+) and that’s reflecting in my reduced time on actual work (self-employed).

learnbyexample ,
@learnbyexample@programming.dev avatar

I mostly read fantasy and sci-fi, which tend to have multiple books in a series. If they are easy-to-read and short (300-400 pages per book), it becomes easy to consume. Also, I read for escapism, so I don’t read too closely.

learnbyexample ,
@learnbyexample@programming.dev avatar

When I was younger, I’d read slowly, trying to visualize the setting, keep track of character preferences, look up words I don’t know, etc. I’d remember a book well enough to talk about it even a year or so after.

These days, I just skim over descriptions and read as fast as I could while still getting the main plot. I get attached to characters only if the book is really good and savor them during rereads.

learnbyexample ,
@learnbyexample@programming.dev avatar

True, perhaps a case of doing too much of anything over a long period ;)

learnbyexample ,
@learnbyexample@programming.dev avatar

+1 for Cradle already mentioned. I’d add

  • The Riyria Revelations by Michael J. Sullivan
  • Kings of the Wyld by Nicholas Eames
learnbyexample OP ,
@learnbyexample@programming.dev avatar

That’s great to hear and thanks for the kind feedback :)

learnbyexample ,
@learnbyexample@programming.dev avatar

<span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">a</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">'alias'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a c=</span><span style="color:#183691;">'clear'
</span><span style="color:#323232;">a p=</span><span style="color:#183691;">'pwd'
</span><span style="color:#323232;">a e=</span><span style="color:#183691;">'exit'
</span><span style="color:#323232;">a q=</span><span style="color:#183691;">'exit'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a h=</span><span style="color:#183691;">'history | tail -n20'
</span><span style="font-style:italic;color:#969896;"># turn off history, use 'set -o history' to turn it on again
</span><span style="color:#323232;">a so=</span><span style="color:#183691;">'set +o history'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a b1=</span><span style="color:#183691;">'cd ../'
</span><span style="color:#323232;">a b2=</span><span style="color:#183691;">'cd ../../'
</span><span style="color:#323232;">a b3=</span><span style="color:#183691;">'cd ../../../'
</span><span style="color:#323232;">a b4=</span><span style="color:#183691;">'cd ../../../../'
</span><span style="color:#323232;">a b5=</span><span style="color:#183691;">'cd ../../../../../'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a ls=</span><span style="color:#183691;">'ls --color=auto'
</span><span style="color:#323232;">a l=</span><span style="color:#183691;">'ls -ltrhG'
</span><span style="color:#323232;">a la=</span><span style="color:#183691;">'l -A'
</span><span style="color:#323232;">a vi=</span><span style="color:#183691;">'gvim'
</span><span style="color:#323232;">a grep=</span><span style="color:#183691;">'grep --color=auto'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># open and source aliases
</span><span style="color:#323232;">a oa=</span><span style="color:#183691;">'vi ~/.bash_aliases'
</span><span style="color:#323232;">a sa=</span><span style="color:#183691;">'source ~/.bash_aliases'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># sort file/directory sizes in current directory in human readable format
</span><span style="color:#323232;">a s=</span><span style="color:#183691;">'du -sh -- * | sort -h'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># save last command from history to a file
</span><span style="font-style:italic;color:#969896;"># tip, add a comment to end of command before saving, ex: ls --color=auto # colored ls output
</span><span style="color:#323232;">a sl=</span><span style="color:#183691;">'fc -ln -1 | sed "s/^s*//" >> ~/.saved_commands.txt'
</span><span style="font-style:italic;color:#969896;"># short-cut to grep that file
</span><span style="color:#323232;">a slg=</span><span style="color:#183691;">'&lt; ~/.saved_commands.txt grep'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># change ascii alphabets to unicode bold characters
</span><span style="color:#323232;">a ascii2bold=</span><span style="color:#183691;">"perl -Mopen=locale -Mutf8 -pe 'tr/a-zA-Z/𝗮-𝘇𝗔-𝗭/'"
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">### functions
</span><span style="font-style:italic;color:#969896;"># 'command help' for command name and single option - ex: ch ls -A
</span><span style="font-style:italic;color:#969896;"># see https://github.com/learnbyexample/command_help for a better script version
</span><span style="font-weight:bold;color:#795da3;">ch</span><span style="color:#323232;">() { whatis $1</span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">man $1 </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">sed -n </span><span style="color:#183691;">"/^s*$</span><span style="color:#323232;">2</span><span style="color:#183691;">/,/^$/p" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># add path to filename(s)
</span><span style="font-style:italic;color:#969896;"># usage: ap file1 file2 etc
</span><span style="font-weight:bold;color:#795da3;">ap</span><span style="color:#323232;">() { </span><span style="font-weight:bold;color:#a71d5d;">for</span><span style="color:#323232;"> f </span><span style="font-weight:bold;color:#a71d5d;">in </span><span style="color:#183691;">"$</span><span style="color:#323232;">@</span><span style="color:#183691;">"</span><span style="font-weight:bold;color:#a71d5d;">; do </span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">PWD</span><span style="color:#183691;">/$</span><span style="color:#323232;">f</span><span style="color:#183691;">"</span><span style="font-weight:bold;color:#a71d5d;">; done; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># simple case-insensitive file search based on name
</span><span style="font-style:italic;color:#969896;"># usage: fs name
</span><span style="font-style:italic;color:#969896;"># remove '-type f' if you want to match directories as well
</span><span style="font-weight:bold;color:#795da3;">fs</span><span style="color:#323232;">() { find -type f -iname </span><span style="color:#183691;">'*'"$</span><span style="color:#323232;">1</span><span style="color:#183691;">"'*' </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># open files with default application, don't print output/error messages
</span><span style="font-style:italic;color:#969896;"># useful for opening docs, pdfs, images, etc from command line
</span><span style="font-weight:bold;color:#795da3;">o</span><span style="color:#323232;">() { xdg-open </span><span style="color:#183691;">"$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">amp</span><span style="font-weight:bold;color:#a71d5d;">;></span><span style="color:#323232;"> /dev/null </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># if unix2dos and dos2unix commands aren't available by default
</span><span style="font-weight:bold;color:#795da3;">unix2dos</span><span style="color:#323232;">() { sed -i </span><span style="color:#183691;">'s/$/r/' "$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="font-weight:bold;color:#795da3;">dos2unix</span><span style="color:#323232;">() { sed -i </span><span style="color:#183691;">'s/r$//' "$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span>
learnbyexample ,
@learnbyexample@programming.dev avatar

I used to use it for posting on Twitter, with some keywords (like book title) in bold.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines