Tuan Anh

container nerd. k8s || GTFO


Safari Tab Switching is a Safari SIMBL plugin which allow switching between tabs using Cmd+1-9.

The most annoying thing (aside the web inspector) when I switch back to Safari due to a power consumption issue with Chrome.

link bài gốc

Maxel - a native download accelerator for OS X

Maxel is a download accelerator—it splits each download into parts and downloads the parts simultaneously, maximizing your bandwidth.

maxel - download accelerator app for os x

link bài gốc

A better sitemap for jekyll

jekyll sitemap use site.time for lastmod so it doesn’t really reflect the actual last modified date of the post but the last updated date of the site instead.

I’m not so sure if lastmod attribute has much effect on Google’s crawl rate/SEO to your site since it’s optional but I’m a little picky even when it comes to small thing like this.

Since last modified date is available from the source file, it should be generated automatically from that. kinnetica’s sitemap plugin for jekyll make use of .mtime for lastmod in sitemap which is the actual last modified date of the post.

Clone the repo, put sitemap_generator.rb in your _plugins folder and you’re all set.

jQuery Tips and Tricks

If your daily job has to deal with jQuery, you should definitely read this.

link bài gốc

Is Mailbox (for Mac) the last email client you ever need?

tl;dr: No, hardly.

The much anticipated Mailbox app for Mac released its first public beta today. Too bad, it seems to me that Mailbox has failed to live up to the expectation.

Mailbox was originally released as an iOS app only. The design is very simple and elegant with an unique take on swiping/snoozes features. I’m a big fan of Mailbox for iOS and I’ve been waiting for Mailbox to release their Mac app companion ever since Sparrow abandoned.

I realize that this is just the first public beta release so there are obvious many kinks that need to work out. I just don’t like the direction Mailbox for Mac is going.

The iOS version is simple and I prefer it to be stay that way. When I check my emails in the morning on my phone, my workflow is like:

  • act on it if i can finish it within 5 minutes.

  • archive it there is nothing to do and no further action required.

  • select Later if there’s action needed to be done but cannot be done rightaway.

  • repeat the process.

On my computer, however, I expect many more features than just that. Being acquired by Dropbox earlier, I at least hope that feature like using Dropbox for attachment would be available on day 1. Ever since Sparrow introduces that feature, it’s been one of my must-have feature in an email client. You have complete control over the attachment even if the email is already sent. I can even delete it if I regret after clicking send. I can even update the file without resending the email.

The email composer is seriously lack of features. No markdown, no HTML, no quoting whatsoever. Just pure plaintext. Simplicity is good but it’s no excuse for the lack of features.

The UI looks modern but definitely not my thing. It’s way too bright and the contrast is too low for my taste. And there’s no preferences to customize the UI. You’re stucked with the default.

I will stick with Airmail for now. With some little tweaks, Airmail can look pretty decent and quite feature-complete for me. It’s the closest thing to Sparrow I can find.

airmail os x

Fix unable to download huge files with varnish

I recently stumble against a problem with my varnish setup. I couldn’t download any file (huge ones) from my webserver (nginx). The problem only seems to occur with varnish enabled.

A little Google-fu, I found that the problem indeed was caused by varnish because varnish was intefering (timeouts and post-processes) with the request from client.

The fix is simple: let client and server talk directly without varnish interfering using pipe.

sub vcl_recv {
  # condition to trigger pipe
  if (req.url ~ "^/path/or/file/extension/or/whatever/condition/you/have/") {
    return (pipe);
sub vcl_pipe {
  set bereq.http.connection = "close";

Try wget your files again. It should be fixed now.

Lift - an app that put your goals into action

Lift is an app that help you to form/track/analyze new habits. This is part of my new experiment to become a better self. Some of the stuff I like to do it more often and more regular like: pushup every morning, drink more water, learn new language, talk to one stranger a day, etc.. for starters.

I’m still very much in the process of learning, tweaking this method. But that’s the beauty of it. Becoming a better you than yesterday is not just a habit, it’s a way to improve life.

Localization with jekyll

Do you want to create a multilingual blog with jekyll? Here’s an easy way to setup jekyll to have content in multiple languages.

Create localized string data file

Create a folder named _data if you don’t already have one. Inside that folder, create a localization data file and name it messages.yml.

mkdir _data
touch messages.yml

Edit messages.yml and add localized strings. For the moment, I will just create a simple phrase and 2 localized strings in English and Vietnamese for testing purpose.

    example: "example"
    example: "Ví dụ"

Display localized strings on post/page

Now you need to capture the locale of the current page. You can do it either by capturing the url (if you organize posts by folders of language’s name) or from the page variable. To make it easy in this port, i will use the current page’s locale variable; if not specified then default to ‘en’.

locale: "vn"

Get the localized string with this syntax

{{ site.data.messages.locales[locale].example }}

And that’s it. Go back and add more localized strings, update templates and publish changes. Your website is now multilingual.

To make it even more visitor-friendly, you can create a separate RSS feed for each one of the language.

Alternatively, you can use jekyll-multiple-languages-plugin1, though I’m not a big fan of using plugin when not I don’t really need to.

  1. http://rubydoc.info/gems/jekyll-multiple-languages-plugin/1.2.5/frames 

My favorite tiling window manager for OS X

The problem of window manager has been with us ever since GUI and multitasking were introduced. Despite being considered as a most modern OS, OS X failed short when it comes to window manager, especially when compared with Linux. I’ve tried many so-called tiling window managers for OS X. All have failed for me so far but Amethyst.

To name a fews that I’ve tried: SizeUp, Spectacle, DoublePane, Slate, BetterSnapTool and some others… Most of them are not tiling but just simple window managers.

I’ve tried Amethyst before but it was not stable enough for daily usage at the time. I like the concept every much though. I later settled on SizeUp and Witch combo for window manager. They suck. But they suck the least at the time. And most importantly, it wasn’t really tiling at all.

About Amethyst

Tiling window manager for OS X similar to xmonad. Was originally written as an alternative to fjolnir’s awesome xnomad but written in pure Objective-C. It’s expanded to include some more features like Spaces support not reliant on fragile private APIs.

A quick screencast to show basic features of Amethyst

Getting started with Amethyst

Basic usage of Amethyst is very well-covered in its documentation on GitHub. I won’t go into details here. Some commonly used shortcuts are:

  • mod1 - option + shift

  • mod2 - ctrl + option + shift

  • mod1 + space — cycle to next layout

  • mod1 + j - focus the next window counterclockwise

  • mod1 + k - focus the next window clockwise

  • mod1 + return - swap the focused window with the main window

  • mod1 + h - shrink the main pane

  • mod1 + l - expand the main pane

That’re probably all you need to know to get started with Amethyst. Go figure some more when you’re familiar with the new tool. All of them are configurable in .amethyst configuration file in your home directory.

Amethyst is probably the best tiling window manager for OS X right now. It’s simple, intuitive and very lightweight with a low learning curve. You don’t have to learn a whole lot of new shortcuts to make the best out of Amethyst. It’s currently the top app on my software recommendation list.

Post scheduling with jekyll

First, update your _config.yml and set future to false. By doing this, jekyll will not publish any post with future date.

future: false

Setup a cronjob to check and rebuild the site if there’re posts to be published. Since I already setup a hook on post-receive (trigger on receving a git push) to rebuild the site, I’m going to set a cronjob to execute this script instead of writing something new. The content of the post-receive looks like this.

# post-receive
#!/bin/bash -l

jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW

Cronjob that execute post-receive every hour at 0 minute, everyday.

@hourly /path/to/my/post-receive

The only downside of this is you need to be able to setup cronjob. GitHub Pages and shared hostings are probably not going to work in this case. You will need to verify this yourself.