How HTTPS works

Nice comics to explain how https works.

https://howhttps.works/

Regex lookahead and lookbehind

(?=foo)
Lookahead
Asserts that what immediately follows the current position in the string is foo

(?<=foo)
Lookbehind
Asserts that what immediately precedes the current position in the string is foo

(?!foo)
Negative Lookahead
Asserts that what immediately follows the current position in the string is not foo

(?<!foo)
Negative Lookbehind
Asserts that what immediately precedes the current position in the string is not foo

Ref: http://www.rexegg.com/regex-lookarounds.html

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

https://stackoverflow.com/questions/10638996/reverse-timestamp
http://hbase.apache.org/0.94/book/rowkey.design.html

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 https://pypi.python.org/simple/alembic/: 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 https://bootstrap.pypa.io/get-pip.py | 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 https://bootstrap.pypa.io/2.6/get-pip.py | python

The python -m ensurepip will give you pip 6.1.1, then the get-pip.py 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.

Tacoma Narrows Bridge (1940)

https://en.wikipedia.org/wiki/Tacoma_Narrows_Bridge_(1940)