Saturday, February 20, 2016

Cleaning Out Old Mail in Gmail Automatically

Mike Cleckner
Software Engineering | Project Management • Software Development • Quality Assurance
linkedin.com/in/mcleckner



Coffee Mug
This morning, with my cup of coffee in hand, I sat down at my computer and started to go through my email. I finished clearing out my inbox using my GTD strategy and then decided to clean out old mail that I don't care about.

I've been using filters in Gmail to automatically label and move my email out of my inbox.

That certainly cuts down on the amount of mail I have to deal with my inbox. I'll periodically read the email I've filter, but sometimes I don't really care about them and it builds up. I realize we've got oodles of "free" email storage with Gmail, but it really bugs me to see all those unread messages piling up.

I've been relying on my PC based mail application to archive certain mail or manually entering a search criteria within Gmail. I've been using Thunderbird for my Email Client, but I'm finding more and more that I just prefer to use the Gmail web interface. Thunderbird seems to be bloating and it's slow to run on my PC (Ok, so my PC is 5 years old, but it works. I'm not upgrading just for a better Email experience).

To trash these old emails, I use a search query finding all the mail for a certain label older than so many days and not part of my GTD strategy.

label:Newsletters older_than:10d -label:_Keep -label:!NextAction -label:!Waiting -label:!Delegated -label:!Someday -label:!Scheduled

I never figured out a way to automatically clear out old junk from within Gmail. Filters don't work, because they are for mail as it arrives. A few choice Google searches and I came across this post "Set Gmail To Auto-Delete Emails Older Than A Set Number Days" from 2013, which inspired me to revive my coding skills and have at it.

I used the basic concept from that post and combined it with a Hash Table implementation to create my own automatic clean up Google Script for those "I might read sometimes" emails; each label having its own retention policy. I have scheduled it to run once a day.

The Solution

My solution differs from the original post's implementation:

Thumbs Up
  1. I am not using a Gmail Filter to tag email as "delete me," because I already have filters set up to label my emails. 
  2. I am not using a blanket age criteria. Based on the label, I can have different retention ages (this is where the Hash Table implementation comes into play).
  3. I am using the GmailApp.search() to find the emails to clean up instead of GmailApp.getUserLableByName().

First, I created a new Google Scripts project and imported the Hash Table implementation and called that script file Class-HashTable.gs.

Second, I created a new script file in my project, cleanUp.gs, and implemented my version of the cleanUp() function.

function cleanUp() {

  var MailCleanHash = new HashTable( {Weather: 7, Newsletters: 10} );

  for (var i = 0, keys = MailCleanHash.keys(), len = keys.length; i < len; i++) {

    // I want to exclude anything that I have labeled "_Keep" or is Starred
    var excludeStr = "-label:_Keep -label:!@Next_Action -label:!Waiting -label:!Delegated -label:!Someday -label:!Scheduled";
 
    var searchStr = "label:" + keys[i] + " " + excludeStr + " -is:starred older_than:" + MailCleanHash.getItem(keys[i]) +"d";
 
    var threads = GmailApp.search(searchStr);
    for (var t = 0; t < threads.length; t++) {
      threads[t].moveToTrash();
    }
  }
}


Third, I set my trigger for the script to run once a day.

Done!

Now my email will automatically be cleaned up without my intervention.

Tuesday, June 23, 2015

Two-factor Authentication: What Is It and Why Should You Use It


Mike Cleckner
Software Engineering | Project Management • Software Development • Quality Assurance
linkedin.com/in/mcleckner

Have you ever heard of two-factor authentication and thought to yourself, “What the heck is that?”

Well, you can Google or Bing or Yahoo or Duck-Duck-Go it and find out more technical details. I’ll give you the high-level, person-on-the-street explanation in this blog post. I’ll start off by saying that I am not your cyber security expert. I don’t have thirteen letters after my name endorsing my cyber-security credentials. I’m just practical and curious and I did some searching on the web. I’m a geek and a techie. You need to be responsible for yourself and your cyber-life. Take what I write here as a starting point for you to research more into the topic and decide if it is right for you. You need to do some leg work. This is simply an introduction.

What is two-factor authentication?

Two-factor authentication is defined on Wikipedia (https://en.wikipedia.org/wiki/Two-factor_authentication) as:

… provides unambiguous identification of users by means of the combination of two different components. These components may be something that the user knows, something that the user possesses or something that is inseparable from the user. 

Security GuardIn your everyday life, the example is the PIN for your ATM card. The ATM card is your first level of authentication: it tells the machine that you have a bank account, the bank, etc. Your PIN (which shouldn’t be written on the back of the card!!!) is the second level of authentication. Another example is when you call your Health Insurance provider and they ask you to provide your mailing address, date of birth, and the last four digits of your social security number. Hopefully, knowing all those things in addition to your account/member number ensures you are who you are supposed to be.

So two-factor authentication boils down to using a primary and secondary method of verifying that you are who you say you are and that you should have access to this service. For services on the web, it gives you a second level of verification to ensure that you should be accessing the web site. This means that if someone managed to guess or steal your password, then they won’t automatically gain access to that service because they don’t (hopefully) have the second layer of security. 

What is that second layer?

sconeWell it depends. For some web sites/services like Gmail, you could use a text message sent to your cellphone with a code or a token generated by an application or a phone call to your phone telling you the code to enter. It can vary from provider to provider; service to service. Basically it boils down to, some other method to ensure that the person trying to access your account/service is you. These secondary validation methods are tied to something that you (ideally only you) have access to or would require a really bizarre set of circumstances for a non-authorized person to have access to (like
you left you cell phone, with no lock code, that you use for the secondary method validation sitting next to your laptop in Starbucks when you went to the counter for another scone).

Isn’t this just going to be a pain for me? I don’t want to go through this EVERY time I log in.

Well, yes. It can be a pain, but nothing is for free right? If you want the extra security, then you’ll have to deal with the extra 5 or 10 seconds to get the secondary access-code and enter it. Boo ho, was that REALLY so bad?

Seriously, depending on what device you are accessing the service from and the kind of two-factor authentication the service provides, it is possible to tell the service to “remember” you on this device. This way you don’t have to go through the whole process again. That sounds like a great idea, right? Well, sure it is convenient, but you should think twice about what devices you enable that on. If you carry your laptop around with you, then maybe it would be better to deal with the extra layer of authentication just in case you happened to leave your laptop somewhere. With your desktop at home (or your laptop at home that never gets to go anywhere), it probably is safe to have the service “remember” you.  If nefarious computer hacking ninjas decided to invade your home and take your
professional ninja
computer, then I guess it might not have been a good idea. On the plus side, if you find out that your authenticated (i.e. stop asking me for the secondary password!) device is stolen or lost, then you should be able to reset the service’s two-factor authentication. That means it won’t “remember” that device anymore and ask whomever is trying to log into the service for the second layer of authentication.

Many of these service also provide multiple ways to get that second authentication token/code. Let’s say that your primary way to get the token was a text message to your cellphone, but you forgot to bring it with you, then another method can be used. 

(I can’t imagine that you would actually do that. I’m sure you got 30 minutes away from home and panicked. “Where’s my cellphone?” And motored right back home to get it.) 

Sometimes this is a set of a dozen one-time codes that you print out and put in your purse or wallet; or it could be a phone call to another number. Review the two-factor authentication abilities that are provided by the service. There should always be at least two ways for you to get that token/code. Just in case.

So why should you use two-factor authentication?

For security. For peace of mind that someone isn’t into your Gmail or sending out Tweets from your account or messing with your LinkedIn profile (You were a circus clown for three years. Interesting.) or defacing your Facebook profile. You probably don’t need to worry about it, unless your password is “password” or “123456” or something easy to guess; or you are some high profile person (like Taylor Swift, Jerry Seinfeld, Joe Rogan, or Alison Krauss) that would make you a “fun” target, but why not add that extra layer of security?

For most of us, it is a non-issue until it is an issue. Until some bozo hacks into some website’s backend server and lifts the account information. Seems to me that just happened to Last Pass (https://blog.lastpass.com/2015/06/lastpass-security-notice.html/), although don’t worry because your password wasn’t exposed (uh huh). So why not just use it at least for the services that you really care about. I recommend at least your email account (especially if it is the one you use for “I forgot my password”) and whichever social media service you really, really, really love and use frequently. 

I use it wherever it is available.

Next Steps?

Right. Where are the step-by-step for whatever service instructions? That’s right, I didn’t do that. Take a moment and simply search the internet for information on how to do it for whatever service. 

(We are living in the information age for Pete’s sake!)

Pretty much EVERY popular service on the web has this wonderful thing called HELP. Click on that and then search for “two-factor authentication”. Or use your favorite web search portal and type “two-factor authentication <service>”. 

For example “two-factor authentication twitter” (Here’s my search for that -- https://duckduckgo.com/?q=two-factor+authentication+twitter) and go with the result actually from that service (Here’s one from my results for that -- https://blog.twitter.com/2013/getting-started-with-login-verification). 

So look into it some more. Check out what is provided by your service and set it up. If you don’t like it, then you can just disable it. No big deal. 

What’s the worst thing that happened? 

You learned something new and tried it out.

Sunday, June 14, 2015

What Ants (Yes, Ants!) Reminded Me about Job Searching


Michael Cleckner 
Software Engineering
Project Management • Software Development • Quality Assurance
linkedin.com/in/mcleckner


After another week of pursuing opportunities, which really means another week of being caught in the black hole known as "the hiring process," I sat on my deck with my morning
cup of coffee. The weather was perfect, but my attitude was not. You see, I'm out of work, not by my choice. I'm frustrated. I'm burnt out from submitting job applications, networking with people, and following job leads to dead ends. But if you are reading this, then chances are you're in the same boat too. Misery loves company. Welcome.


There I sat, brooding, when I noticed these little ants scurrying around on the table. There were dozens of them. Randomly running this way and that way. A few got too close to my coffee mug, so I squished them.

 (I know negative karma points for me.)


But then other ants happened to come upon their fallen compatriots and you know what they did? They picked them up and carried them away. Now you could have a sinister view of why the ants took their fallen comrades away (the ants are of course out looking for food), but I started to imagine that perhaps they were "helping" them. "Hey, buddy! Man you're having a hard go of it. Let's go get some aphid juice. What have you been up to?"

Lesson 1:
Don't stop being connected with your former colleagues. They are a source of support. They know what kind of person you are, how well you did your job, and really wish you were still working with them.

Now, your former colleagues aren't going to necessarily get you a job. They don't really want to listen to you drone on and on and on about how miserable you are (that's what your dog or cat or goldfish are for), but they keep you connected to what's going on in your industry. And who knows, they might have a job lead at some point. They know your qualities, your skills, and what kind of coworker you are. If you are staying in touch, then they might think of you first.

Then I started looking around more. There were a lot of these little ants everywhere on the deck!

(Someone should really do something about it, instead of sitting around drinking coffee.)

Many were randomly scurrying around. Here and there I noticed that some were actually walking with a purpose. They were following something. Sure enough, where the ants marched with purpose, there was food at the end of the trail. There were a lot ants gathered around the food, picking off pieces, and others stacked up behind trying to get to the front of the queue. A frenzy of activity. Looking around I saw other lone ants or smaller groups of ants working on other food sources. These weren't large pieces of food, but food nonetheless.


Lesson 2:
Search with focus. Have your targets, but don't forget to look at other possibilities.

You're not the only one trying to get that job. Following the crowd you might get a shot at the popular opportunity, but your chances are lower and you'll probably wait longer. Look around for opportunities you might not have thought about before; your odds are better with less competition. Opportunities at a Fortune 500 company that you really want to work at will attract a lot of other job seekers. Look around for positions at smaller growing companies. Most likely there will be fewer job seekers applying for the position. There might be some compromises with pay or other benefits because it is not a huge company, but you might be surprised and find a great job with great people.

 Feeling a bit mischievous and bored, I decided to torment the ants that were marching in a fairly solid line to and from a larger piece of food. I took a small stone and placed it right on their little ant highway.


 (I waited for a break in traffic, because I didn't need any more negative karma points.)


There was confusion and chaos for a bit. Ants, who first came upon the obstacle, started to dart back and forth. Panic! Other ants did the same until one or two happened to bump into ants returning from the food, who were also in a panic. They had a little ant conversation, as far as I could tell, and then both would continue on their way going where the other had just come from. After a few more of these meetings, a new path around the stone was established. The ant highway was restored!

Lesson 3:
Be persistent. When something gets in your way, find a way around it. Remember your goal.

You're going to hit obstacles during your job search. You'll get that face-to-face interview, spends hours preparing, and hours at the interview, only to get the "Thank you for your interest in the position, but ..." email. It is depressing. It can demoralize you. You'll scramble around asking why. You'll find yourself brooding over a cup of coffee on your deck one morning. Pick yourself up. Look for something positive to take away from the experience. Move on. There is another opportunity out there.

So that's what those ants reminded me about my job search. Maybe my story will give you some renewed motivation as you pursue that new position.

Oh. How does the story end for those ants?

Well, I know that I was outside in their world, but it is MY deck, and there is a huge yard that they can do whatever they want in. I have to protect my territory; my market share! I really don't enjoy ants getting into my food or crawling on me, even if they gave me some inspiration.

I got the hose out and washed them and all their little treasures all away.

Buh-bye.

(Hey, at least I didn't squish them all.)