Richard Lucas' Blog

CS stuff and more...

Useful CLI commands

Some CLI Commands that I’ve found useful:Viewing processes and killing them$ lsof -Pi | grep LISTEN Displays processes running and ports The PID is the second number (2nd column from left) $ kill......

Resizing image with imagemagick

Quick one-linerUsing imagemagick to resize an image, keep it’s proportion (i.e. 4 x 3 ), and place it in the middle with a white background: 1convert input.png -resize 1280x800 -background white -g......

Mocking out the Request module in Node.js for Testing

So, recently I needed to write a test that required that I mock the request module out as I wanted to pass a specific error code back to the response handler and do something different with it. In......

Importing CSV in Postgres

Log into the database from the terminal:1$ psql database_name Create a new table:123456789# CREATE TABLE table_name(column_name data_type, column_name2 data_type, etc);example:# CREATE TABLE trips(......

Installing Postgres on Linux Mint

###A Quick Guide Open up the terminal:1$ sudo apt-get install postgresql Installs Postgresql. This will take a few minutes. Next:1$ sudo su - postgres This logs you into the database as the postgr......