os x

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.


Screen Capture Command on Mac

(This article was intended to be written on 18th Sep 2016, but actually written on 8th April 2017)

In order to take a screenshot on Mac, the standard way is to the Grab application.

Keyboard users often get used to these.

⌘ + ⇧ + 3  - full screen which generated a file on Desktop
⌘ + ⇧ + 4 - capture custom dimensions using the mouse.

I recently discovered that screencapture command is part of the OS X. I happen to have the need to paste a screenshot in a chat (in the current world, input boxes or gmail compose allows you to paste an image inline without the need to have a file on disk)

screencapture -c -i

solves most of my needs to capture interactively with output into the clipboard.