Sai Ram's Blog

thoughts, ramblings and ideas of a geek

CLI Productivity Tools - FZF & Yank

fzf

Came across an powerful CLI fzf utility. There are plugins for vim, tmux and bash too. If you are a command line junkie like I am, you should definitely not miss this.

yank

do check out yank and on mac with

brew install yank

source: http://brewformulas.org/yank

Now fzf | yank

ps -ef | fzf | yank

copy the selected output from fzf and copy it into clipboard. There are lots of other options. The demo is just the book cover.


Data Visualization Tools

As part of work I was looking at a problem and came across an amazing set of Data Visualization tools. You may have seen this Data Visualization Talk from couple of years ago.

Data Visualization by GapMinder is a proper tool for analyzing large sets of data.

This video below is dated (2003), but the tool can be used as-is at gapminder.org/tools

The vision of GapMinder is to fight ignorance with a fact based worldview that everyone can understand

Other Tools

Finding the types of charts


Bypassing the paste restriction on the browser

Banking sites and Mac OS Keychain makes you intentionally type in your credentials. These can be usually bypassed with help of browser specific extensions using Password Managers like 1Password or LastPass. Its also important to note that have their own downsides aka bugs.

Being a developer using a keyboard for hours every day since 10+ years, being productive will become a mandatory requirement for me personally. By unblocking websites and Mac from restricting me to use the bypassed paste, I feel invincible on the keyboard. Although you need to think through of other security implications of using the clipboard to store sensitive data.

The advantages for me were

  1. Bypassing the paste restrictions
  2. Pasting text from the browser without styles into existing notes / cheatsheets.

The paste has been both an important and tough to bypass. The bank websites stop you to use the Paste option in all possible ways with the help of Javascript and they do not work without Javascript (which is sad)

Old Solution

I used an Alfred Workflow called Type to achieve that till it became unusable when I upgraded to Sierra (10.12). The workflow has become buggy, I think its part of the OS itself or something I did not spend time figuring out.

New Solution

While struggling with this problem for about a week and avoiding to type where ever possible, I came across “HammerSpoon”, a desktop automation tool . A desktop automation tools helps you script/automate tasks. Its written in Lua.

What can HammerSpoon do?

You can write Lua code that interacts with OS X APIs for applications, windows, mouse pointers, filesystem objects, audio devices, batteries, screens, low-level keyboard/mouse events, clipboards, location services, wifi, and more.

It is simple to script out what you need with the help of the exhaustive documentation

Find the script for Paste bypass

Here is my current configuration. I can now right click with my keyboard or even scroll without going to the arrow keys on the browser.



How to scale requests to a single IP (DC)

Scaling app servers to nearly unlimited size is easy to explain but really hard in practice. It basically amounts to this:

  1. Balance requests using DNS anycast so you can spread load before it hits your servers
  2. Setup “Head End” machines with as large pipes as possible (40Gbps?) and load balance at the lowest layer you can. Balance at IP level using IPVS and direct server return. A single reasonable machine can handle a 40Gbps pipe….
  3. Setup a ton of HTTP-proxy type load balancers. This includes Nginx, Varnish, Haproxy etc… One of these machines can probably handle 1-5 Gbps of traffic so expect 20 or so behind each layer 3 balancer…
  4. Now for your app servers. Depending on if you’re using a dog slow language or not, you’ll want between 3 and 300 app servers behind each HTTP proxy.

Information source: https://news.ycombinator.com/item?id=13357278