Thoughts & Experiments.

Read this first

Laravel + Postgres local setup.

Here are the steps to get your local (mac) environment setup with Laravel and Postgres.

 Bash commands:

laravel new my-project
cd my-project

 Make the Postgres database:

While you have postgres running locally, use the createdb command line tool to create a new database.
createdb my-project

 .env File:

Edit the .env file in your Laravel project.

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=my-project
DB_USERNAME=<your-mac-username>
DB_PASSWORD=password

 Migration setup:

php artisan migrate:install

That’s it! You’re rocking and rollin’ with a local Laravel & Postgres setup!

View →


Deep learning AWS EC2 set up

This is an accompanying blogpost which goes along with a video I’ve made about my AWS EC2 Deep Learning setup. The setup goes through the process of installing git, tmux, htop, and security certificates on an EC2 deep learning image. The bash scripts mentioned in the video can be found on the ml-setup repo.

 The commands:

sudo yum update -y
sudo yum install -y tmux htop

SSL:
mkdir ssl
cd ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout "cert.key" -out "cert.pem" -batch

Notebook security:
ipython
from IPython.lib import passwd
passwd()
Enter in the password which will be used to authenticate the Jupyter Notebook on the website. Paste this SHA string in some note-taking app, you’ll need it in a bit.
vi ~_.jupyter_jupyter_notebook_config.py
Note: The fastest way to jump to the bottom of a file in vim is :$ or <ESC>GA according to this question.
Paste in the...

Continue reading →


3 (Free) Must Have Tools For Any Developer

productivity.png

These three tools will undoubtedly supercharge your developing workflow. I’m not quite sure how I could ever live without them.

dash.png
Dash is a great tool for letting you download and browse documentations for your favorite programming languages and API’s. It is perfect for when you have to be productive with little to no wifi (since the docsets are downloaded locally). I use Dash to make the most of the AWS API, Laravel API, and sometimes even the vim cheatsheets. Tons of other docsets are available.
Download Dash

trello.png
Trello has quickly become one of the most popular productivity tools for developers. It allows you to quickly come up with tasks, and organize them in a logical manner. I normally create 3 columns “Todo”, “Doing”, and “Done”. For me, the real power of Trello was unlocked when I installed the Planyway extension. This extension adds a calendar (which can be synced with my Google...

Continue reading →


Redis won’t talk to Web Server.

redis-aws-love.png

 The Problem:

Thinking you’ve correctly configured everything in your shiny new cloud architecture, and having a key piece not work properly can be extremely frustrating.

For me, it was trying to get a web server (on EC2) to talk to a Redis cluster (on ElasticCache).

Trying to use redis-cli on my local machine kept getting me to this point:

Could not connect to Redis at xxx.usw2.cache.amazonaws.com:6379: Operation timed out

This is when I found out that Redis by default isn’t meant to be accessed from outside the sphere of AWS. Since I was running redis-cli from my laptop, this wasn’t going to work.

The next logical step was to SSH into my EC2 machine, and then run the redis-cli command to try and PING the Redis host. But this method also ran into the timed out error.

Since the machine on AWS couldn’t even produce a handshake with the Redis host, this is when I knew that there...

Continue reading →


A look at DynamoDB Key’s.

dynamodb-aws-keys.png

Today, coming primarily from a MySQL background, I realized that choosing the right DynamoDB data structure requires some thinking. Here are some things I wish had been clearer before I started:

The situation:

  • In an Express.js Application, I am trying to access all the records from DynamoDB table.
  • I am following the Node.js documentation for Query’s.
  • Keep coming across a database error about keys. Unable to access any data.

For the sake of this situation, let us imagine that we are creating a table in our DynamoDB database which will hold Tweets from different users.
We should be able to:

  1. Loop through the Tweets of a specific user in chronological order.
  2. Get a specific Tweet from a user.

PartitionKey
Image from the AWS blog.

 What is the Primary Key?

A unique identifier which identifies a single record in the database. This Primary Key is the combination of the Partition Key and Sort...

Continue reading →


Launch a website for free.

website.jpg

Being able to launch a website for free* is really easy these days.

I prefer writing vanilla HTML / JS / CSS. But to make my life a bit easier, I think I’ll be switching over to using Cactus.

 Developing your site

  • Write HTML / JS / CSS in some folder called website
  • cd into that website folder and run the following command in terminal: python -m SimpleHTTPServer 8000. This will actually serve the website on http://localhost:8000. As a bonus tip, you should edit your ~/.bash_profile file and set alias pythonserver='python -m SimpleHTTPServer 8000'. This will allow you to run the pythonserver command instead of having to memorize all that python gibberish.

 Launching your website

When it comes to deploying your website for the world to enjoy, you have a couple of options.

Options #1: Use github pages. This is a great option for people who are comfortable using git. Basically...

Continue reading →


3 apps that every college student should use

These apps will super-charge your life. They’ll make you more productive than you’ve ever been. They’ll pretty much write that 900 word essay you’ve been procrastinating on.

Here’s a list of 3 incredibly sexy apps that are available on all platforms (Mac / iPhone / Android / PC). There are a lot of great apps out there that can achieve the same thing, but these apps will work no matter what device you’re on.

 Sunrise

 The calendar app you’re not too sure how you lived without.

sunrise.png

This app can connect to just about any type of calendar service. I have it connected to my Google and Facebook accounts. It makes staying up-to-date dead simple. For instance, I have a “classes” tag where I add all my class discussions / lectures from SmartSite and set the events on repeat. And thanks to it being connected to Facebook, any event I click “Going” on will also appear in this calendar. It also...

Continue reading →


“Work like hell”

 If other people are putting in 40-hour workweeks, and you’re putting in 100-hour workweeks, then, even if you’re doing the same thing, you will achieve in four months what it takes them a year to achieve.

– ELON MUSK

View →