Follow via rss feed
2020-04-28 Batch conditional resize of images
Imagemagick features a painlessly simple way to conditionally resize an image.
The following mogrify
command (this executable, contrary to magick
, overwrites the same file), using the inline syntax, shrinks all jpegs in the directory to a maximum aspect of 1024x1024, preserving the aspect ratio, and only if one of the dimensions is originally beyond that size.
mogrify '*.jpg[1024x1024>]'
2020-04-23 Fun with the BSD Calendar
I have a calendar.system
within my $CALENDAR_DIR
with the following included calendars:
#include <calendar.computer>
#include <calendar.fictional>
#include <calendar.history>
#include <calendar.holiday>
#include <calendar.music>
#include <calendar.ushistory>
#include <calendar.usholiday>
#include <calendar.world>
#include <fr_FR.UTF-8/calendar.proverbes>
#include <ru_RU.UTF-8/calendar.common>
#include <ru_RU.UTF-8/calendar.primety>
#include <ru_RU.UTF-8/calendar.history>
If ever in want of a time-wasting culturo-history lesson, the following does the trick:
$ calendar -f calendar.system
abr 23 Бодун на утро от: Открытие Бразилии, 1500г.
abr 23 Crowning of King Ellesar (LOTR)
abr 23 Bavarian co-rulers Duke Wilhelm IV and Duke Ludwig X proclaimed the
weighty and consequential Bavarian Beer Purity Law
(later Reinheitsgebot), 1516
abr 23 Hank Aaron hits his first home run, 1954
abr 23 Shakespeare born, 1564
abr 23 À la saint Georges,
Sème ton orge,
À la saint Marc,
Il est trop tard.
abr 24 The Greek enter Troy with the Trojan Horse, 1184BC
abr 24 Victory Day in Togo
abr 24* Pesach - First Day of Passover - Festival of Freedom
abr 24 Антипы Водопола. Полагают, что в это время реки очищаются ото льда.
abr 24 Изобретение микроскопа, 1676г.
abr 24 Схвачен Степан Разин, 1671г.
2020-04-18
I encourage anyone to experiment with as great a variety of living conditions as possible (and plausible), including the ways of the vagabond. This shapes you into a stronger individual equipped to handle unforeseen hardships with minimal stress. And better do this earlier in life. At a certain point, 60 years for some, 30 for others, stigma and comfort become too heavily engrained.
Ideas:
Shipping vessels, multi-day camping, hostels, the jungle, cramped cells or capsules, mountains, painfully long airport layovers, 24-hour bathhouses, host families, temples, and generally as much of travel and life abroad as possible.
2020-04-09 Vary the details.
I write about varying the ways in which you exercise your habits. I write about randomness and spontaneity. But I fall into the trenches of routine.
I don’t refer to the routine in the grand scheme of things. I don’t mean the powerful exercise or work habits. That is the good routine to maintain for at least some respectable time period; at least before you venture to toss your whole life into the clutches of the food processor.
I mean the micro-details: the meal preparations, walk routes, the speed at which you operate, the exercise intensity and the types, the forms of creative stimuli, the communication methods, the choices of overused vocabulary, the clichés, the place of dining, et cetera.
Vary those to introduce a bit of the eclectic into your life.
2020-04-06 Linux distribution invariance
I’m ultimately not too concerned about what Linux distribution I run; that is, provided:
I can disable or replace any default packaged component, which is usually straightforward beyond the kernel and system-level functions.
Any desired package not available via the respective packaging system is available from source or alternate origins. This implies the availability of certain build and source packages for C-based applications, or pil/cpan for Python/Perl based solutions.
That’s about it. The majority of my workflow revolves around terminals, command-line/N-curses based tools, VIM for all editing/writing/hacking and the Perl/Shell (maybe Lisp) interpreters; and, of course, the standard system/GNU commands.
Any Linux-based setup tends to provide these basic features. The rest is flexible.
My Android tablet, which serves as my main computer, provides strictly just the above within Termux, a restricted Pseudo-Debian based environment. It facilitates most needs.
Web page viewing requiring a graphical web browser (about 10% of web browsing needs) I handle via the default Android browser. The same applies for any Video content. The majority remainder takes place within Termux.
Interestingly, Android provides a selection of XServers available from the Play Store. Termux can actually communicate with these via the available X libraries. I’ve even asserted the link … it works.
I could run any graphical Linux application in this fashion. But I don’t use them. I can take care of everything via terminal-based functionality. Including image and audio manipulation. :)
2020-04-03 Still using Bitpocket for two-way synchronization
I’ve been using bitpocket for one/two years now for nearly all my backup and synchronization needs.
The solution consists of but a single shell script, leveraging rsync for all the dirty work, albeit in clever ways.
I’d done away with Dropbox, Google, or any closed or cloud-based solutions for any but short-lived, ephemeral data.
I document more of my usage here.
2020-04-01 Automatically delete unwanted emails in Mutt
I’ve added a guide with instructions on using Mutt to automate the deletion of all those emails we don’t deem spam-worthy, but make a habit of sending to trash anyway.
The steps ultimately result in two new macros in Mutt:
- One to add the sender of the current email to the (pseudo) spam group.
- Another to delete all emails with from addresses belonging to the group.
Anytime I receive a batch of new mail, I normally execute the above macro without even a glance at the content. The emails are not actually directed to trash until you close mutt or sync-mailbox executes. And even with an accidental deletion, as long as you haven’t emptied the trash, you can still recover the deleted items.
2020-03-30 Reverse blocks of text via headings with tac
tac (reverse of cat) reverses not only all lines of text, but blocks of entries via heading specifiers.
The following takes the entries from notebook.txt
, delineated by date in the format YYYY-MM-DD
, and arranges them in reverse:
$ tac -s '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' -rb notebook.txt
The -r
flag causes the entry separator to be treated as a regular expression, while -b
causes the separator to precede the entry, per the original ordering.
Since tac doesn’t support Perl-compatible regex, I couldn’t append each character range by a repetition construct (ie ‘[0-9]{4}’), hence the verbosity.
I found this extremely useful to transform my journal entries, ordered in increasing date order, to a web format, generally ordered by decreasing date.
2020-03-29 Recovering a deleted email draft in VIM
As I was composing a long email over a period of days in Mutt, upon the final redact, I realized to my horror that I’d accidentally deleted the draft on the last occasion. VIM, however came to the rescue.
- I entered the VIM swap directory,
~/.vim/swap
(this configured in.vimrc
). - I located the most recent file with
mutt-localhost
in the name. (Or your host name in lieu of localhost). The file carried the approximate date of the last redact. - I copied the full path of that file.
- In VIM (any session), I executed
:recover <swap file path>
.
Voilà, my entire draft re-materialized. I made sure to now explicitly save it before venturing back into Mutt. Who knows how long that particular swap file would persist.
2020-03-27 Favorite programming and spoken languages
I don’t write much code these days other than hacking my existing tools. Do I have a favorite language? Depends on the scenario:
Perl for hacking together CLI applications/interfaces. The procedural ‘Swiss army knife’ of an esoterically engineered language bears immense aesthetic appeal.
Pure shell script for producing very quick CLI scripts.
Lisp (particularly Picolisp) for independent experiments and intellectual preference, although I never carry it to any production purpose. Were I an Emacs user, I would passionately script Emacs Lisp. Alas, even after 10 years of active VIM usage, I take no likeness in VIM script.
A Turing machine for even nerdier theoretical proofs; as close to production value as a hamster on a wheel from Mars.
If I had to perform any systems programming, I would resort back to plain C.
What about the spoken tongue? This too depends:
- Portuguese: colloquial language to unearth my warmest emotions (these still equivalent to a wrench) and break into song.
- Polish: Slavic language of choice to synthesize my eastern roots with western influences.
- Russian: standard, colloquial, most familiar communication.
- English: formal, eloquent, even antiquated language.
2020-03-26
Be attune in times of hunger, pet-peeves, or lack of certain control. For my part, when exposed to one of these unfriendly conditions, I (still) house a vile tendency to become irritable, judgemental and sometimes even unreasonable. But I’ve also grown keen to immediately self-reflect.
2020-03-24
Many years ago I would struggle to remain in silence and do nothing for long periods. Now I marvel in the state. I consider the aptitude a privilege, if it even deserves to be classified in those terms. Lights dim, distractions zero, no chatter; no toxicity within reach; nothing but a cup of herbal tea with garlic and ginger; nothing but the mind, the fierce wind, and the starry sky.
2020-03-23 The Most-Frequently-Used
In one guide I discuss access to most-frequently-used data. Particularly relevant points:
- Seamlessly append to a global quick notesfile from varying CLI apps.
- An important documents folder with symlinks to diverse, scattered documents. How had such a simple organizational solution not occurred to me earlier?
- Search disparate text-based content (also covered here).
Questions, comments? Connect.