Friday, October 13, 2023

xdotool workaround for opening an email in conversation view in thunderbird 115.3.1

With a recent update of Thunderbird, I've noticed that when I open an
email with conversation view (with Ctrol+Shift+O), the messages are
not properly sorted anymore. I had to click the sort-by-date menu and
sort-by-thread menu, respectively, every time.
 

I've written a script to automate that boring process as you can see below.

#!/usr/bin/bash

xdotool mousemove 500 500
xdotool click 1
xdotool key ctrl+shift+o
sleep 1
xdotool key --delay 100 alt+v s e
sleep 1
xdotool key ctrl+shift+o
sleep 1
xdotool key --delay 100 alt+v s t
sleep 1
xdotool key 0x002a
xdotool mousemove 500 335

I store this script in dom0 and name it xdo-thread. I map this script
with F5 key. Now, every time I want to see the messages in
conversation view, I simply press F5. 


There's one tricky part I'd like to point out. The line "xdotool click 1" is a trick. Without it, we can't use "xdotool key". I'm not sure what the reason is yet. Maybe it's about window focus.

Sunday, July 9, 2023

High-speed trains

Someone has once said “Life is a journey, not a destination.” However, for
decades, technological advancement in high-speed trains has been only focusing
on decreasing the time it takes to travel from one place to another. That’s
purely an oversight of how much quality time we can have to make bonds with
our friends, family members, the mother nature, and even ourselves while we’re
traveling on the trains.

We can’t deny that the most famous nation that has been developing the
fastest high-speed trains is Japan with its state-of-the-art Shinkansen, aka the
bullet train. It claims that within the next few years, their bullet train will be
able to travel at the maximum of 320 Km/h. That sounds crazy, isn’t it?
There’s also the so-called Hyperloop, an ambitious engineering project, which
was recently reintroduced to the world by SpaceX, a high-tech company owned
by one of the richest and smartest guy on earth, Elon Musk. With this tech-
nology, they aim to reach a top speed of 1,220 Km/h, which is 4 times higher
than the Japanese’s!

However, nowadays, more and more people are starting to see the importance
of journey and ways to spend quality time with those they love. This is exactly
how the low-speed train idea was born. Imagine you are traveling by a train
which is passing through a fantastic scenery in Hokkaido or Switzerland which
could take your breath away. I bet you wouldn’t want a high-speed train during
the trip.

In conclusion, we should combine both the high-speed and low-speed train
technologies into a new one called, mixed-speed train. This train will travel
fast when it is passing through dull areas and slow when it is passing through
wonderful places. I’m writing this article on a train. Next station, Changi
Airport. Thank you for reading.

Thursday, June 8, 2023

I loved BG

Poem
by Langston HughesI loved my friend.
He went away from me.
There’s nothing more to say.
The poem ends,
Soft as it began—
I loved my friend.

Poem
by ... I loved my friend.
BG went away from me.
There’s nothing more to say.
The poem ends,
Soft as it began—
I loved my BG.

How to record video without sound on Android?

 Line Camera + Samsung's Screen Recording (without Sound)

Thursday, May 11, 2023

Was life really better?

\begin{document}

\maketitle

People often talk about how life was better in the `good old days', but
how true is that?  Let's look into my views of life before and after the
smartphone era.

Life was absolutely different when there was no smartphone.  Your bosses
and co-workers could not easily reach out to you via instant messaging
apps after work hours or while on holidays.  If they really needed to
contact you, they had to give you a call.  Giving someone a call means
that it has to be a matter of utmost importance.  This helped filtering
out less important or disorganized matters from reaching out to us.
Moreover, even within work hours, allowing other people to text you any
time they wish is a great distraction at work which reduces productivity
tremendously.  Every time we get distracted by someone, involuntarily,
while we are working on something, it will take an average of 23 minutes
and 15 seconds to refocus \cite{lastoe20}.  In order to circumvent this
problem, some companies allow each employee to set his/her own
workplace-distraction-hours.  Anyone who needs to talk to another person
has to check his/her schedule first.

However, I agree that there are many benefits that come with smartphone.
Things such as Duolingo, a language learning app, which allows us to
learn new languages at any time and places we want, or Google Maps,
which makes it extremely easy to travel without having to give too much
effort into planning, are really useful.

In conclusion, there are countless benefits we can get from smartphone,
but we have to be aware of the pitfalls that come with it.

\begin{thebibliography}{10}
  \bibitem{lim23} Alex Lim et al,
    \textit{Constant companion: Our lives with mobile phones
    https://www.straitstimes.com/multimedia/graphics/2023/05/mobile-phones-singapore/},
    The Straits Times,
    10\textsuperscript{th} May 2023.

  \bibitem{fried18} Jason Fried et al,
    \textit{It Doesn't Have to Be Crazy at Work},
    Harper Business,
    2\textsuperscript{nd} October 2018.

  \bibitem{lastoe20} Stacey Lastoe,
    \textit{https://www.themuse.com/advice/this-is-nuts-it-takes-nearly-30-minutes-to-refocus-after-you-get-distracted},
    TheMuse.com,
    19\textsuperscript{th} June 2020.
\end{thebibliography}

\end{document}

Monday, May 8, 2023

How to enter unicode character in Linux?

You can enter unicode character in Linux by:

    Ctrl + Shift + u

follows by the unicode number, e.g., 1F43E for the Paw Prints character.

Sunday, May 7, 2023

Paw Prints in Unicode

Unicode U+1F43E   ðŸū

is the cat's paw print character!


Sunday, April 23, 2023

Should people have animals as pets?

 Archaeology suggests that people might first have animals, such as dogs and cats, as pets since at least 12,000 years ago.  After a very long period of time, animals that have been consistently kept in captivity and selectively bred became friendly to human, unlike their wild relatives.  However, how can we be certain that pets are really happy when being cared for by people?
    Pets provide their owners with emotional benefits.  They help people cope with anxiety and stress.  Elderly adults who often have less interaction with other people can find companionship with their pets. There are many examples of people who found their purpose in life after being introduced to pets.
    On the other hand, notwithstanding the benefits for human, pets may not really want to be kept in captivity.  As a living creature, shouldn't they be allowed to decide on what they actually want? Shouldn't we allow them to live freely outside and come to our houses whenever they feel like, such as stray cats?
    In conclusion, we will continue to have pets because the ten thousand years of pet culture will not be able to changed easily. Therefore, we should take a good care of our pets and provide them with whatever they need to increase the chance that they will live happily in our house in return for their helps on our emotional health.  "In ancient time, cats were worshipped as gods, they have not forgotten this." - Terry Pratchett.

The camel and the cat



Once upon a time, a camel, who always obeyed the rules, was traveling through an arid desert.  It was really hot and dry.  The camel walked pass a few wells every day. However, every time the camel found a new well, there was always a sign warning it not to drink the water.  The camel was exhausted.  Day after day, it still couldn't find a well without the warning sign.  The camel thought it would die from dehydration soon.  One day, the camel saw another well, as always, with a warning sign.  But, this time, the camel also saw a cat, who always didn't care about any rules, coming out from a nearby tunnel.  The cat was also thirsty.  The cat also saw the warning sign.  But, the cat ignored it, went straight to the well, and drank the water.  The camel was completely stunned.  The camel decided to follow the cat and drank the water from the well too.  After the camel had finished drinking, the camel asked the cat why the cat ignored the warning sign. The cat said the weather was really hot, the water was there to be drunk, the cat only saw what were necessary to be seen.

Tuesday, April 11, 2023

How to convert plain text file (.txt) into PDF via LibreOffice command-line?

Nowadays, major Linux distributions come with LibreOffice pre-installed.  Isn't it better for text-based users to use LibreOffice's command-line tool to convert their plain text files into PDF without having to install other programs?

% libreoffice --convert-to "pdf" file.txt