Interests: Regular Expressions, Linux CLI one-liners, Scripting Languages and Vim
That’s great to hear and thanks for the kind feedback :)
I used to use it for posting on Twitter, with some keywords (like book title) in bold.
alias a='alias'
a c='clear'
a p='pwd'
a e='exit'
a q='exit'
a h='history | tail -n20'
# turn off history, use 'set -o history' to turn it on again
a so='set +o history'
a b1='cd ../'
a b2='cd ../../'
a b3='cd ../../../'
a b4='cd ../../../../'
a b5='cd ../../../../../'
a ls='ls --color=auto'
a l='ls -ltrhG'
a la='l -A'
a vi='gvim'
a grep='grep --color=auto'
# open and source aliases
a oa='vi ~/.bash_aliases'
a sa='source ~/.bash_aliases'
# sort file/directory sizes in current directory in human readable format
a s='du -sh -- * | sort -h'
# save last command from history to a file
# tip, add a comment to end of command before saving, ex: ls --color=auto # colored ls output
a sl='fc -ln -1 | sed "s/^\s*//" >> ~/.saved_commands.txt'
# short-cut to grep that file
a slg='< ~/.saved_commands.txt grep'
# change ascii alphabets to unicode bold characters
a ascii2bold="perl -Mopen=locale -Mutf8 -pe 'tr/a-zA-Z/𝗮-𝘇𝗔-𝗭/'"
### functions
# 'command help' for command name and single option - ex: ch ls -A
# see https://github.com/learnbyexample/command_help for a better script version
ch() { whatis $1; man $1 | sed -n "/^\s*$2/,/^$/p" ; }
# add path to filename(s)
# usage: ap file1 file2 etc
ap() { for f in "$@"; do echo "$PWD/$f"; done; }
# simple case-insensitive file search based on name
# usage: fs name
# remove '-type f' if you want to match directories as well
fs() { find -type f -iname '*'"$1"'*' ; }
# open files with default application, don't print output/error messages
# useful for opening docs, pdfs, images, etc from command line
o() { xdg-open "$@" &> /dev/null ; }
# if unix2dos and dos2unix commands aren't available by default
unix2dos() { sed -i 's/$/\r/' "$@" ; }
dos2unix() { sed -i 's/\r$//' "$@" ; }
Check out https://github.com/auctors/free-lunch (list of free Windows software)
See also https://www.nirsoft.net/ (freeware, not open source)
If he likes games, check out “Invent Your Own Computer Games with Python”: https://inventwithpython.com/invent4thed/
If you are looking for books, check out:
Intermediate:
Advanced:
I have a book for Perl One-Liners as well, which I’m currently revising :)
I’ve written books on regex too, if you are interested in learning ;)
Thanks a lot for the feedback on Coreutils book! It’s so nice to hear that it helped in your thesis.
Regarding the ebook versions, I use pandoc
to convert GitHub style Markdown to PDF/EPUB (wrote a blog post about my process here: https://learnbyexample.github.io/customizing-pandoc/). I had to search through stackexchange threads to customize the few things I could. I don’t know how to fix the kind of page breaks you mentioned. But, I’ll try to find a solution. Thanks again for the feedback :)
Hope you find the book useful :)
I’d also suggest these shorter guides to get started:
See also:
Inspired by explainshell, I wrote a script (https://github.com/learnbyexample/command_help) to be used from the terminal itself. It is a bit buggy, but works well most of the time. For example:
$ ch grep -Ao
grep - print lines that match patterns
-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines. Places a
line containing a group separator (--) between contiguous groups of
matches. With the -o or --only-matching option, this has no effect
and a warning is given.
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with
each such part on a separate output line.
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.
See also:
https://github.com/WyattBlue/auto-editor - automatically editing video and audio by analyzing a variety of methods, most notably audio loudness
https://github.com/shssoichiro/oxipng, https://pngquant.org/ and https://github.com/RazrFalcon/svgcleaner for optimizing images
Yeah, PCC is a good choice. Make sure to type examples codes manually (i.e. don’t just read them) and try to solve all the exercises. Since you mention you want to learn it as a hobby, “Automate the Boring Stuff with Python” (2nd edition) would be a good choice as well, as you might find some of the projects in the second half helpful.
I have a list of curated resources here: https://learnbyexample.github.io/py_resources/
There are sections for beginners, intermediate, advanced, etc. Also included are exercises, projects, debugging, testing, and many more stuff. Hope it helps :)