Installing let's encrypt
You must own or control the registered domain name that you wish to use the certificate with.
Create an A Record that points your domain to the public IP address of your server. This is required because of how Let's Encrypt validates that you own... Read more
Installing and using PM2
PM2 is a process manager for Node.js applications. It provides an easy way to run them in the background as a service.
sudo npm install -g pm2
Manage an application with PM2
Use the pm2 start... Read more
Computing the distance between documents.
A document is a sequence of words and a word is an alphanumeric string. To compute how similar or different 2 documents are from each other we shall look at the words that they share. In order to do this we sha... Read more
One dimensional arrays
The data structure
So we have an array:
| a | b | c | d | e | f | g | h | i |
The characters a through i represent unkno... Read more
A free variable is not bound within a function in which it is used. It is not declared within the function or passed in as a parameter, but is still used within the fun... Read more
Objects are bags of properties (own properties). Each object has a link to a prototype object.
A prototype is a property of functions and objects that are created by constructor functions.
When an inherited function is executed 'this' points to the inheriting object, not t... Read more
Replacing partial strings in MySQL databases
I'm sure there's a better way but sometimes I need to replace a partial string in a database. For example replacing a domain name.
Be careful with this. Find/replace is awesome and if you're not careful it can really screw you up. With that in mind:
UPDATE DBNAM... Read more
Squashing git commits
One liner to squash the last n commits. Don't do this if you've already pushed commits upstream. Rewriting history isn't cool.
git reset --soft HEAD~3 && git commit -m"Squashing last 3 commits"
Example given above is for the last 3 comm... Read more
Beautiful idiomatic Python
<... Read more
Django apps and extensions for all occasions
<... Read more
Installing and using virtualenvwrapper
Virtualenv is a part of everyday life. However it can be painful to manage a ton of virtual environments. Without careful management, adding virtual environments all over the place can cause clutter in version control.
virtualenvwrapper allows storing as many virtual environments as you ne... Read more