Notes

AWS CLI aliases

AWS CLI commands can be quite verbose, but happily there's a feature that isn't described in the main docs which allows you to create custom commands. To set it up do the following:

$ mkdir -p ~/.aws/cli
$ touch ~/.aws/cli/alias

~/.aws/cli/alias

[toplevel]

whoami = sts get-caller-identity

profiles = 
  !f() {
    cat ~/.aws/credentials \
    | awk '/\[.*\]/' \
    | tr -d '\[\]' \
    | sort
  }; f

Now you can create shorter aliases for more common or complicated commands and save yourself a bunch of time.

There are more examples in the awslabs repo.

Adding Emoji Support to MDX files

The remark plugin remark-emoji will transform short codes like :rocket: into their unicode equivalent (🚀). It's not a transformer plugin, it's remark plugin, so config is a little different to normal:

$ npm install --save remark-emoji

gatsby-config.js

  {
    resolve: "gatsby-plugin-mdx",
    options: {
      remarkPlugins: [
        require('remark-emoji')
      ]
    }
  }

Jump whole words with the arrow keys in iTerm2

In iTerm2 goto Preferences > Profiles > Keys, find ⎇← and change it to "Send escape sequence" with "Esc+" set to b. Do the same for ⎇→ but set "Esc+" to f.

You will now be able to move left and right a word at a time with ⎇← and ⎇→.

fzf Basics

fzf is a command line fuzzy finder that integrates with your favourite shell to make a bunch of tasks better and few tasks way better.

$ kill -9 <tab>    # fuzzy search over for the process you need to kill.
$ <Ctrl-R>         # fuzzy search for that command you don't want to retype.
$ cat <Ctrl-T>     # fuzzy search for any file in the current directory.

fzf Preview

With fzf you can specify a command that will preview the selected option. The output of the preview is rendered next to search results.

fzf --preview 'exa --tree --level=2 --group-directories-first --color=always {}'