Aaron James Younghttps://ajy.co
JavaScript Developer and Ultra RunnerMon, 20 Apr 2020 16:26:41 +0000en-US
hourly
1 https://wordpress.org/?v=5.4.1https://ajy.co/wp-content/uploads/2020/03/cropped-logo-co-large-32x32.pngAaron James Younghttps://ajy.co
3232Better Hummingbird Picshttps://ajy.co/better-hummingbird-pics/
https://ajy.co/better-hummingbird-pics/#respondMon, 20 Apr 2020 16:26:40 +0000https://ajy.co/?p=667I had to stand very still outside for a few minutes but I got a couple better pictures of our Rufous.
]]>https://ajy.co/better-hummingbird-pics/feed/0The first hummingbirdhttps://ajy.co/the-first-hummingbird/
https://ajy.co/the-first-hummingbird/#respondThu, 16 Apr 2020 16:44:36 +0000https://ajy.co/?p=652Here’s a shot (through a window) of the first hummingbird we’ve gotten here at our new house.
]]>https://ajy.co/the-first-hummingbird/feed/0Taking back email – Part 5: msmtphttps://ajy.co/taking-back-email-part-5-msmtp/
https://ajy.co/taking-back-email-part-5-msmtp/#respondWed, 16 Mar 2016 04:39:43 +0000https://ajy.co/?p=399Recently, I decided to revamp my email setup. I don’t really love email, but it’s such an important method of communication that I needed to get it under control. I’m going to put together a several-post guide explaining my reasoning, technical details, and my new email process.

Other posts in this series (all will be linked here as the posts go up:)

Intro

alot to read and compose email, and khard for integrating an address book

msmtp is a utility for sending email through an SMTP server. After you compose an email using alot, msmtp will handle sending it out. You’ll want msmtp installed on the machine you are using to compose email – so I have it installed on my two workstations rather than on a centralized server.

(In practice, I have it on the server as well in case I ever need to ssh in and write an email, but I haven’t used that option yet).

Installing msmtp

In Arch Linux, msmtp is in the standard repositories. Install it like so:

sudo pacman -S msmtp

Configuration

I should mention that the Arch Linux wiki is really helpful for just about everything, and msmtp is no exception. They have a great article here.

After installing, copy the example configuration into your home directory and start editing!

cp /usr/share/doc/msmtp/msmtp-user.example ~/.msmtprc
vim ~/.msmtprc

Overall, editing this file is pretty easy – just follow the example. Your SMTP server may require some specific settings, so play with it a bit. See some testing tips in the next section of this post.

Here’s an example of one of my accounts, with some sensitive information edited:

account ajy
host smtp.example.com
port 587 # Alternatively, try port 465 if this one doesn't work
from aaron@example.com
user aaron@example.com
# tls and password - you should decide how you will handle these

For the TLS certificate and password settings, follow the examples in the config file based on what strategy you will use.

Set a default account:

account default : ajy # Choose an account name as specified above

Testing your configuration

To test your SMTP configuration, I recommend creating an email in a text file: vim test-mail.txt with something like the following content:

Use real To and From emails so you can confirm the mail actually goes through.

Then, run this command:

cat test-mail.txt | msmtp -a account-name

The -a flag specifies which account will be used. Replace account-name with the name of an account from your .msmtprc file.

Integrating with alot

In practice, you won’t have to deal directly with msmtp. Instead, the send command in alot should invoke msmtp automatically.

To set this up, see the previous post in this series (linked at top). The example alot configuration I supplied includes configuration for msmtp on a per-account basis.

Next

A final wrap-up!

]]>https://ajy.co/taking-back-email-part-5-msmtp/feed/0Taking back email – Part 4: alot and khardhttps://ajy.co/taking-back-email-part-4-alot-and-khard/
https://ajy.co/taking-back-email-part-4-alot-and-khard/#respondTue, 15 Mar 2016 04:00:56 +0000https://ajy.co/?p=397Recently, I decided to revamp my email setup. I don’t really love email, but it’s such an important method of communication that I needed to get it under control. I’m going to put together a several-post guide explaining my reasoning, technical details, and my new email process.

Other posts in this series (all will be linked here as the posts go up:)

Intro

alot is a simple email client that is meant mainly to be a front-end to work with your notmuch email database. alot provides easy ways to view and read your email, to search, and to compose email. Alot does not, however:

Receive email (we’re using OfflineIMAP to grab email from the server)

Send email (in the next post, I’ll cover using msmtp to handle sending out email)

khard is a command line contacts manager that can read a CardDav-generated contacts directory. I won’t cover too much about khard in this post, other than how it integrates with alot to make it easier to write your emails.

Installing alot and khard

For Arch Linux, both alot and khard are in the Arch User Repository. Use your favorite AUR helper, something like:

I start with a few basic settings. I tell alot to open a new terminal window, running vim, when composing an email.

Next, I define the keybindings – first, global keybindings, then the keybindings in different views (thread, envelope, etc.). Note that some of these keybindings can run a series of commands, one after the next.

Finally, I define basic settings for each email account – the sendmail command, and the address book configuration. When I am composing email, I can use my tab key to find email addresses from the khard address book.

HTML email

You’ll likely want to be able to read HTML email. The easiest way to handle this is to install w3m, a basic console web browser:

Syncing your configuration files

I’ve mentioned that I use Syncthing for syncing my email folder. I also sync my alot and khard configs from one workstation to another. This way I don’t need to worry about having an out-of-date configuration file on one of my machines.

Configuring khard

I’m not going to get too far in here since it’s right at the edge of the scope of this series. Here are the basics:

If you are using a CardDav server to handle your contacts, you should set up vdirsyncer to periodically sync your contacts into a directory (the contacts directory is called a vdir). You can sync this directory between your computers.

Of course, after installing khard, you’ll want to set up your config file. Run vim ~/.config/khard/khard.conf. Here’s the example config. Modify as needed.

Using the above alot configuration settings, alot will use the khard address book to tab-complete email addresses for you when composing email.

Using alot

When you open alot, you’ll be greeted with any unread / inbox messages you have. Note that you’re not viewing an IMAP directory – instead, it’s a view of messages with a certain tag.

You can press o, or type :search to start searching:

:search tag:archive

:search Chris

etc.

To compose, type :compose and fill out the information you’re prompted for. You’ll get a Vim window where you can write the email. When you’re done, type :wq in vim to save and quit. Then, back at your alot window, type :send to send the email (but you’ll need msmtp installed and configured to actually send the mail).

These are a couple basic usage tips. You’ll pick up alot pretty quickly. It’s handy to remember that typing a question mark ? will show you a list of keybindings for your current view, and you can use the :help command to give you additional hints about a particular command.

Next

Next, we need to get msmtp installed, so you can send email. Stay tuned!

]]>https://ajy.co/taking-back-email-part-4-alot-and-khard/feed/0Taking back email – Part 3: notmuchhttps://ajy.co/taking-back-email-part-3-notmuch/
https://ajy.co/taking-back-email-part-3-notmuch/#respondMon, 14 Mar 2016 01:51:00 +0000https://ajy.co/?p=395Recently, I decided to revamp my email setup. I don’t have too much going on with email, but it’s such an important method of communication that I needed to get it under control. I’m going to put together a several-post guide explaining my reasoning, technical details, and my new email process.

Other posts in this series (all will be linked here as the posts go up:)

Intro

notmuch is an email indexer and tagger. It’s used to create a searchable database of mails and to allow you to arbitrarily tag emails with different keywords. Searching for your email is easy and SUPER fast with notmuch.

I have notmuch installed on my home server along with OfflineIMAP, although using a remote VPS would work just as well. This way, my email folders and database have a central home, and I can sync them to my various workstations with Syncthing.

Installing notmuch

This is easy in Arch Linux:

sudo pacman -S notmuch

Notmuch might be packaged for your Linux distro as well. Check in the repositories – if not, then check the notmuch website.

Configuration

Instead of copying and editing a config file, notmuch bootstraps the configuration. Just run a command:

notmuch setup

And you’ll be dropped into an interactive setup. Simply answer the questions:

Your full name (“Aaron Young”)

Your primary email address

Add any other email addresses you are configuring (this all will mirror your OfflineIMAP config)

The path to your mail directory. This is the same folder where OfflineIMAP is downloading your email.

Tags to apply to new mail: “unread” and “inbox” are the defaults and they’re just fine, but feel free to add or remove tags to fit your workflow. These tags will be automatically applied by notmuch on new emails that come in.

Tags to exclude when searching email – these are the emails that you never really want to see.

Now, you can take a look at the config that was generated:

vim ~/.notmuch-config

and see how you like it.

Running after OfflineIMAP sync

So the basic setup so far has OfflineIMAP checking for new email, once an hour with your cron job, and putting it in your local mail directory. Let’s have notmuch tag those new emails.

Use crontab -e to edit your crontab, and add:

47 5-21 * * * offlineimap && notmuch new

Now, notmuch will process your email after offlineimap has finished downloading it. Of course, this is the same cron command that I mentioned in the last post in this series, but now we understand the second part.

Next Steps

Now, our central server is fetching and indexing your emails, and you may have set up Syncthing or a similar service to sync your mail folder between all your workstations. Next, I’ll discuss how to use alot and khard to read and manage your email messages.

]]>https://ajy.co/taking-back-email-part-3-notmuch/feed/0Taking back email – Part 2: OfflineIMAPhttps://ajy.co/taking-back-email-part-2-offlineimap/
https://ajy.co/taking-back-email-part-2-offlineimap/#respondSat, 12 Mar 2016 02:29:10 +0000https://ajy.co/?p=390Recently, I decided to revamp my email setup. I don’t much like email, but it’s such an important method of communication that I needed to get it under control. I’m putting together a several-post guide explaining my reasoning, technical details, and my new email process.

Other posts in this series (all will be linked here as the posts go up:)

Intro

OfflineIMAP is a simple Linux command-line tool that syncs email messages and folders from an IMAP server to your computer (and back). I use it to aggregate emails from my three accounts into a directory on my home server. I have it set up to fetch my email once an hour during my awake-time of the day.

I have OfflineIMAP installed on my home server. My mail is collected and indexed on my server, then I have the folders synced to my home and work computers with Syncthing.

Installing OfflineIMAP

OfflineIMAP is likely packaged for your Linux distro of choice. In Arch Linux:

sudo pacman -S offlineimap

After installing, you should copy the default configuration into your user directory and edit it:

The default configuration file is VERY heavily commented and is pretty clear. I’m just going to hit some highlights here.

Configuration

General

[general]
accounts = ajy,gmail,work

Start with a comma-separated list of accounts. Remember those account names because you’ll be needing them shortly. In fact, I like keeping my account names consistent from OfflineIMAP to notmuch to alot and msmtp, through the whole process.

[mbnames]

So far I am doing nothing with this section.

Accounts

I’m initally only syncing the last two years (730 days) of mail. I don’t need to go further back. Note that I used the account name from above (ajy), and I’m specifying two repositories that I’m going to define next:

In the local repository, everything is pretty straightforward. Using / as a separator means that your email messages will be organized in hierarchical folders to match your IMAP structure. If you’re using Gmail, use type = GmailMaildir.

The remote repository has a bit more going on:

For normal accounts, type = IMAP is appropriate. For Gmail, use: type = Gmail as this contains a bit of auto-configuration that will be handy for you.

You have some options for how to handle your password. I’m not going to get into that here, but read the config file documentation.

The folderfilter setting above excludes certain folders from being synced.

To find the cert_fingerprint setting for your server, run this command:

Of course, replace imap.example.com with your remotehost name. You’ll probably get the fingerprint with colons: XX:XX:.... Remove the colons for the purpose of this config file.

More accounts?

Add a new [Account ...] section and configure two repositories for each account as above.

Testing

Run offlineimap > offlineimaplog.txt to do an initial sync and see if it all works. Hopefully you should get a meaningful error if something goes wrong. You’ll see it in the offlineimaplog.txt file that’s created in the above command.

Running with cron

Right on, it’s all working great. Add this to your crontab:

47 5-21 * * * offlineimap && notmuch new

I haven’t gotten to notmuch in this tutorial yet, but the && notmuch new part just refreshes the tag and index database after offlineimap is done.

This will run offlineimap on the 47th minute of the hour, from 5:47 AM till 9:47 PM, each day.

A note about syncing

I’ve mentioned that since I have multiple computers that I spend a lot of time on (home and work) I want to have my email in the same state from machine to machine. When I get into how to use notmuch, you’ll see that I’m making changes to my email messages that are not going to be synced back to the IMAP server, so I need to use my home server (or an online VPS) to act as the central server.

To accomplish this, I use Syncthing to sync my mail folder (and thus, the notmuch database) to both my workstations. The only drawback is that syncing, though fast, is not immediate – so if I know there has been a change in the last 30 seconds or so (like, the cron above has just run), I’ll wait a minute or so to refresh my mailbox.

Up Next: configuring notmuch to work with OfflineIMAP

]]>https://ajy.co/taking-back-email-part-2-offlineimap/feed/0Taking back email – Part 1: My basic setuphttps://ajy.co/taking-back-email-part-1-my-basic-setup/
https://ajy.co/taking-back-email-part-1-my-basic-setup/#respondFri, 11 Mar 2016 03:15:31 +0000https://ajy.co/?p=386Recently, I decided to revamp my email setup. I don’t have too much going on with email, but it’s such an important method of communication that I needed to get it under control. I’m going to put together a several-post guide explaining my reasoning, technical details, and my new email process.

All posts in this series (they will be linked here as the posts go up):

I’ll be sharing config and usage tips along the way. I haven’t seen an in-depth tutorial to getting all these tools working together, so that’s one of my goals with this series.

Introduction

I have three email accounts that I use regularly. Each account duplicates some things – I have three inboxes, three archive folders, etc. Email clients take different approaches to showing mail from multiple accounts. Some, like Thunderbird, include an option to view “Unified folders” – i.e., all of your inboxes go together into one, etc. Others, like Evolution, prefer to keep things separate.

I pride myself on having a minimal email workflow:

Stuff comes in. I don’t want it to come in very often, so I like to only check once an hour.

If it’s actionable, I take a note of it outside my email system

Optionally, I leave the message in my Inbox to be replied to later

When I’m done with the message, it gets archived. I will search to find it again later.

I get some email that I never want to see again (notifications, etc). That gets deleted.

With three separate email accounts to handle this, though, it’s easy to miss things or to let email pile up in the Inbox (“I’ll take care of that later”). I decided I needed a system that would keep me a bit more accountable to myself. And logging into each account via webmail separately? Not an option. For me, this came with a change in the technical details of how I handle email.

The new setup: Basic email process

As I’m about to describe below, I aggregate all my email into one place now (I am aware that it’s three accounts – my setup will use the correct “from” address when replying to mail, for example).

All email is funneled into one inbox. I only check once an hour.

As soon as it comes to me, I’m going to get it out of the inbox in one of three ways:

Email I never want to see again is deleted directly (if applicable, I’ll unsubscribe first)

Email I want to keep, but is not actionable, is archived

Email I need to do something with (reply, finish a task, etc) is tagged “todo”.

After this, my inbox is empty.

When I’m done with a todo item, I archive it.

The new setup: Tools

OfflineIMAP

My home server (this would work on a remote VPS as well) uses OfflineIMAP to fetch mail from all my accounts once an hour. They go into a folder structure:

mail/

account-1/

subfolder/

another-subfolder/

account-2/

etc…

notmuch

notmuch is an email indexer and tagger. It’s used to create a searchable database of mails and to allow you to arbitrarily tag emails with different keywords.

After OfflineIMAP is finished pulling new email from the server, notmuch runs to make sure the mail database is up to date. Then, I use Syncthing to sync my mail collection and database to my home and work computers.

alot and khard

These are the programs I see and interface with in my process.

alot is an email client. It is specifically made for reading and working with databases created by notmuch. See the picture above to see alot in its full glory.

khard is a contacts manager which reads CardDav-generated contact databases. alot can use khard to autofill email addresses from your addressbook when you write a new message. Like my emails, my contacts are also synced from my server to my home and work computers.

I run alot, khard, and msmtp (below) locally on my work and home computers.

msmtp

msmtp is a command line tool which sends out mail through your SMTP server. After you write the email in alot, msmtp handles the actual sending process.

Coming up next

I’ll dive into how I set up and configured OfflineIMAP on my home server.

Here’s a very simple set of SASS mixins to make it easy to build simple grids without needing a huge framework (even though I totally love Foundation). Even though a framework makes a lot of things simple, it’s overkill for 90% of the page layout work that I actually do in my job.

For me, the perfect grid system…

… is lightweight

… has columns that are flush to the edge of the container, with a gutter in between, and customizable padding inside

… allows an arbitrary number of columns in the container, with optionally wrapping elements to new lines

… makes it easy to resize columns individually

If I can do those things, I can build most layouts that I get from a designer.

The concept is simple, but a bit different than your traditional 12-column grid. In this system, you decide on the fly how many columns to have in your grid:

[row] { @include _fg(6); } // six columns

At this point, each child will use 1/6 of the available width of the container (with gutters in between). Want a particular child to use more – like 2/3 of the available width? Here’s how to do that:

.box { @include _fg_width(2/3); }

This will push subsequent items further out of the way, so they’ll wrap differently.

Edit 1/29/2017

The previous versions of this post featured all the code along with usage. But after a pretty major update to this mixin over the last couple days, I’ve decided it’s not a good idea to keep the code in this post as I’ll have to keep updating it. So instead of supplying all code here, I have it all available for you on Github: https://github.com/aaronjamesyoung/simplest-flexbox-grid along with usage and documentation.

Please feel free to play with it and try it in your projects. Then, let me know what improvements need to be made! I would be particularly interested in documentation improvements too.

The big change that just happened is that we’ve augmented the _fg() mixin to accept a layout (which means you don’t need _fg_width() as often). So you can say:

@include _fg(2 1);

This will give you a 2/3 column + 1/3 column in your layout.

It may not be “simplest” anymore, but it’s sure still pretty simple and is better now.

Play with it

Try changing the mixin numbers I set above (number of columns, width of box 1), as well as the gutter and padding variables.