Tuan Anh

container nerd. k8s || GTFO

Download accelerators, managers for Mac

Maxel - $7.99

This is my favorite download accelerator by far. I usually do a lot of torrenting on my VPS and download them later via direct HTTP. I just need some basic features of a download accelerator. Heck, axel was working well enough for me, except the part that I have to manually parse the link1 to it.

Maxel offers Safari/Chrome extension (Firefox is currently in beta-testing phase) and they are quite good. You can select some text on the website and right click -> Download selected links with Maxel. Maxel will identify the selected text and filter out the links for you. This is what make Maxel a little better than Fat Pipe below.

Maxel doesn’t offer speed control but it’s on checklist of the developer.

Fat Pipe Downloader - Free

Another decent download accelerator, Fat Pipe is very similar to Maxel above in term of features. I find it a bit unstable and the browser extension is less convenient than Maxel.

Fat Pipe is currently (as of this post) free on Mac App Store.

Folx - $19.99

Some notable features:

  • Tagging system
  • iTunes integration
  • Scheduling
  • Speed control

Offers more features than most. More expensive than most ($19.99). The app can download torrent files as well as creating it. Though, if you’re using a private tracker, there’s a fat chance that the app is not white-listed. None of the private trackers that I use (WhatCD, BTN, PTP, etc..) whitelist Folx.

SpeedTao - Free (beta)

SpeedTao is currently in beta (for quite awhile now). SpeedTao also support torrent download but struggles with the same problem of private trackers as Folx.

SpeedTao has an unique feature: remote download, which allows you to add transfer to a remote machine via iCloud or Dropbox.

Personally, I don’t really like SpeedTao because the app seems like an abandonware already.

iGetter - $25

iGetter is feature-rich, works fairly well except the interface looks like it was made in the 90s. Between iGetter and Folx, I’d say go with Folx. Call me cheap but I don’t want to pay $25 for a software that was last updated over a year ago.

Conclusion

I pick Maxel simply because I don’t need more features than that. Your mileage may vary. Maxel does one thing and does it very well for me.

  1. I wrote a small bash script to parse a file contains a list of links, new line seperated to axel and let it download one by one. 


How to lazy-load CSS with JavaScript

Prioritize above the fold content and defer loading CSS can significantly improve your site’s rendering speed (impression, at the very least) and PageSpeed score. Basically, you will inline those CSS rules so that content above the fold (content visible without scrolling down) can be render right away (instead of getting blocked while waiting for the whole CSS file being downloaded), making visitors feel that the site is responsive.

You can use this bookmarklet to identify the critical CSS rules. Note that this will not pickup the @media query. That, you will have to do by yourself for now.

Once you’ve finished identifying those above-the-fold CSS rules and inline them, you will have to lazy-load the rest of the CSS with JavaScript.

If you’re using jQuery, put this in your ready block. Otherwise, write your own version of ready and put it there

This is an example of ready in pure JavaScript. I don’t need jQuery anywhere else on my site so including jQuery is too much overhead for this purpose.

(function(funcName, baseObj) {
  funcName = funcName || "isReady";
  baseObj = baseObj || window;
  var readyList = [];
  var readyFired = false;
  var readyEventHandlersInstalled = false;
  function ready() {
    if (!readyFired) {
      readyFired = true;
      for (var i = 0; i < readyList.length; i++) {
        readyList[i].fn.call(window, readyList[i].ctx);
      }
      readyList = [];
    }
  }

  function readyStateChange() {
    if ( document.readyState === "complete" ) {
      ready();
    }
  }

  baseObj[funcName] = function(callback, context) {
    if (readyFired) {
      setTimeout(function() {callback(context);}, 1);
      return;
    } else {
      readyList.push({fn: callback, ctx: context});
    }
    if (document.readyState === "complete") {
      setTimeout(ready, 1);
    } else if (!readyEventHandlersInstalled) {
      if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", ready, false);
        window.addEventListener("load", ready, false);
      } else {
        document.attachEvent("onreadystatechange", readyStateChange);
        window.attachEvent("onload", ready);
      }
      readyEventHandlersInstalled = true;
    }
  }
})("isReady", window);

Function to lazy-load CSS

function loadCSS(href){
  var ss = window.document.createElement('link'),
      head = window.document.getElementsByTagName('head')[0];

  ss.rel = 'stylesheet';
  ss.href = href;

  // temporarily, set media to something non-matching to ensure it'll
  // fetch without blocking render
  ss.media = 'only x';

  head.appendChild(ss);

  setTimeout( function(){
    // set media back to `all` so that the stylesheet applies once it loads
    ss.media = 'all';
  },0);
}

Once ready, load the rest of the CSS

isReady(function() {
  loadCSS('/assets/css/main.css');
});

Java 9 is coming with money API

Java provides you two exchange providers which are ECB (European Central Bank) and IMF (International Monetary Fund). You also can write our own class implementing ExchangeRateProvider interface. The biggest problem here is the data though, not the implementation . If you work for a bank, problem is solved.

ExchangeRateProvider imfRateProvider = MonetaryConversions
                          .getExchangeRateProvider("IMF"); 
ExchangeRateProvider ecbRateProvider = MonetaryConversions 
                          .getExchangeRateProvider("ECB"); 
link bài gốc

SafariTabSwitching

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.