A Cup of Radicchio A personal website of a power looper, a skateboarder, and a coder |
|
Home Docs Sources Blog GitHub |
HTTP 200 OK
To Whom It May Concern
This is what Radicchio loves so much:
$ # Git.
$ git status && git fetch -p && git branch -a && git tag -l && git pull && git status
The second one is a combination of find
and grep
:
$ # Find and print line(s) of text, based on a specified regex pattern.
$ find . -type f -print0 | xargs -0 grep '<regex>'
The third one is a combination of grep
and sed
(or perl
, where applicable):
$ # Find a text, based on a specified regex pattern, then pass corresponding filenames to Sed (or Perl) for replacing that text with another one.
$ grep -Rl '<regex_to_replace>' | xargs sed -i -e 's/<regex_to_replace>/<regex-replacer>/g'
$ grep -Rl '<regex_to_replace>' | xargs perl -pi -e 's/<regex_to_replace>/<regex-replacer>/g'
The fourth one is a one-time procedure of logging into a VM box or any other remote host, using SSH public key authentication:
$ # Run SSH agent in the background and add a private key.
$ eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa
$ # Log into a running VM box by means of SSH client.
$ ssh -C <vmusername>@<vmhostname>
The fifth one is a series of requests for getting statuses of power supply sensors on a laptop in any modern Linux distro like Arch Linux or Ubuntu:
$ # Query AC adapter.
$ cat /sys/class/power_supply/AC+(AD|1)/online
$ # Query the battery.
$ cat /sys/class/power_supply/BAT1/+(charge|energy)_full
$ cat /sys/class/power_supply/BAT1/+(charge|energy)_now
$ cat /sys/class/power_supply/BAT1/+(current|power)_now
The sixth one is an infrequent, from time to time procedure of adjusting the Hardware Clock and the System Clock in the same time:
$ # Set the Hardware Clock and the System Clock unconditionally, non-synced.
$ sudo hwclock --set --date="CCYY-MM-DD hh:mm:ss" --localtime && sudo date MMDDhhmmCCYY.ss
$ # || || ^^ ^^
$ # YY - Year || || || ||
$ # MM - Month || |+------------ Day of month ------------+| ||
$ # hh - Hour || +----------------------------------------+ ||
$ # mm - Minute |+---------------------- Century ---------------------+|
$ # ss - Second +------------------------------------------------------+
Drink with pleasure, consume responsibly, at leisure!