As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label date. Show all posts

How do you find out the date of next Monday on Thursday, August 29?

I was thinking about it, of course, I could calculate by myself. However, as usual, I was lazy and my brain didnt even want to solve for the answer of one plus one. So, I didnt bother clicking on calendar to view it or simply run cal 9 2013.

Instead, I ran:

 ~ $ date -d 'next monday'
Mon Sep  2 00:00:00 CST 2013

Moving mouse cursor, nah, too much work for me. I rather typed in a command since my hands were on keyboard and focus was in terminal window. Reading cal output, nah, locating next Monday is too much work, although its at first row.

I could be even lazier:

 ~ $ date -d monday
Mon Sep  2 00:00:00 CST 2013
 ~ $ date -d mon
Mon Sep  2 00:00:00 CST 2013

This is first time I typed in such date string for a result I actually wanted to know, and its quite a pretty good usage example in real life. However, I have used date parsing in sleeptil, a Bash function which I did use a few times.

Counting down to next Monday Morning Syndrome to happen? You bet I can. I have coded urtimer as a countdown timer, which I recently added -d, but it wasnt by intention and I hadnt known I would be somehow wanted to know next monday.

 ~ $ sleeptil -v 'next monday 6am'
Mon Sep  2 06:00:00 CST 2013 in 3 days 7 hour 23 minutes 26 seconds
 ~ $ urtimer -d 'next monday 8am'

Screen shows about 81 hours, like this

                   
                                   
                           
                                      
                          

The truth is I wasnt lazy nor my brain didnt want to give me an answer, somehow, I was looking for something different or unique. I could just move my hand to control the mouse, but I didnt. My brain was actually knowing next Monday would be in September. Simple counting, I would know the answer, but I didnt do it.

For some reason, I have developed a set of simple toolswhich seemingly are related to one anotherwithout even knowing I was doing that. Time certainly connects things we least expect, even people if you will, like one who is currently reading.

Anyway, the best one still is:

date -d 'next monday'

I love how you can tell date what you want with these two words.

More than two years ago, I posted Finding large emails in Gmail using Python IMAP with XOAuth, which was really not an easy way if you don't know how to run a Python script.

Now, Gmail finally supports new operators for such task:

size: Search for messages larger than the specified size in bytes Example: size:1000000
Meaning: All messages larger than 1MB (1,000,000 bytes) in size.
larger:
smaller:
Similar to size: but allows abbreviations for numbers Example: larger:10M
Meaning: All messages of at least 10M bytes (10,000,000 bytes) in size.

And this is my test:


It also supports date ranges, no need to browse through pages for old emails anymore. It's fast, only took than more than two years to develop.