Ask for forgiveness, not permission

If it isn’t going to devastate those around you, try it and then justify it. People — whether parents, partners, or bosses—deny things on an emotional basis that they can learn to accept after the fact. If the potential damage is moderate or in any way reversible, don’t give people the chance to say no. Most people are fast to stop you before you get started but hesitant to get in the way if you’re moving. Get good at being a troublemaker and saying sorry when you really screw up.

— The 4-Hour Workweek by Tim Ferriss

How HTTPS works

Nice comics to explain how https works.

Regex lookahead and lookbehind

Asserts that what immediately follows the current position in the string is foo

Asserts that what immediately precedes the current position in the string is foo

Negative Lookahead
Asserts that what immediately follows the current position in the string is not foo

Negative Lookbehind
Asserts that what immediately precedes the current position in the string is not foo


Replacing jQuery With Vue.js

Good read.

Replacing jQuery With Vue.js: No Build Step Necessary

Why it’s worth listening to people you disagree with

We get stronger, not weaker, by engaging with ideas and people we disagree with, says Zachary R. Wood. In an important talk about finding common ground, Wood makes the case that we can build empathy and gain understanding by engaging tactfully and thoughtfully with controversial ideas and unfamiliar perspectives. “Tuning out opposing viewpoints doesn’t make them go away,” Wood says. “To achieve progress in the face of adversity, we need a genuine commitment to gaining a deeper understanding of humanity.”

— Zachary R. Wood

Reverse Timestamp

Long.MAX_VALUE – timestamp

pip install error – [SSL: TLSV1_ALERT_PROTOCOL_VERSION]

I am on osx. And for my particular project I am stuck with python 2.7. (I think python 3 is fine at the moment.) Apparently pip has been acting up. If you do a pip install and getting something like this:

Collecting alembic==0.9.5 (from -r requirements.txt (line 1))
  Could not fetch URL There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
  Could not find a version that satisfies the requirement alembic==0.9.5 (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for alembic==0.9.5 (from -r requirements.txt (line 1))

Check your pip version. pip –version. If you have 9.0.1, that’s the bad version. You will need to get to 9.0.2 or 9.0.3, or maybe version 10, but I will explain later.

If you do pip install –upgrade pip==9.0.3, that will fail with the same ssl error.

Don’t do curl | python at this point, because that will give you the pip version 10, which you may keep getting errors like this whenever you use pip.

from pip._internal import main
ImportError: No module named _internal

If you are making a system-wide change to your pip, then here is how. First remove pip, then install it back.

sudo pip uninstall pip
python -m ensurepip
curl | python

The python -m ensurepip will give you pip 6.1.1, then the call will give you pip 9.0.3. Then you are all set.

If you are making a change to a virtual environment, depending on which python (-p) param you provide, mkvirtualenv always gives me pip 9.0.1 (bad) or pip 10 (bad).

If you end up having pip 10, try pip install pip==9.0.3. If that works then good for you, you can stop here. Otherwise, do the following.

We will need to install another version of python from homebrew.

brew install python2
mkvirtualenv -p /usr/local/Cellar/python\@2/2.7.14_3/bin/python2.7 your_env_name
pip --version
pip install pip==9.0.3

After the mkvirtualenv call, the pip version is 10. Then you can downgrade to 9.0.3.

That’s all if you have to stick with python 2.7. My other projects using python 3 seem ok.