How to see and set your environment variables Print all your current environment variables with $ printenv See a the value for a specific variable with echo $ printenv <YOUR_VARIABLE> or $ echo $<YOUR_VARIABLE> For example: $ printenv MY_API_KEY or $ echo $MY_API_KEY How do I set the variable temporarily? This will set your variable for ONLY…
All posts by theptrk
Postgres tutorial – installing with brew + basics (old)
Updated and vastly improved version (July 8th 2024): link Step 1: Install postgres brew install postgres Step 2: Start postgres server brew services start postgresql Step 3: Create a database Lets call our database “book” $ createdb book Step 4: open the psql shell List all databases in terminal with: $ psql –list Adding the…
Heroku: Node, Express, PostgreSQL Setup
Step 0: Have an app Create an empty app if you dont have one Create a folder, cd into it and initialize your git repo. $ mkdir <app_name>; cd <app_name>; git init Step 1: Install Heroku Install the heroku cli with homebrew $ brew install heroku/brew/heroku Check your heroku installation and login if necessary: $ heroku…
Installing Python and managing Python versions with pyenv (bonus venv)
Step 1: Meet your default python You are on Mac OS. When you run python in your terminal you see this. You have Python 2.7.10. This is your default python. You can do things like add > 8+8 Step 2: Meet your modules From your interpreter you can see your available modules by asking for “help”…
Levels of installing python
This is an opinionated route towards python management. Every computer may have its own set up. Level 0: “I just want to play with python” Method 1: Use and online REPL like this: https://repl.it/languages/python Level 1: “I want python on my computer” Download brew, use brew to download the latest version of python and go crazy.…
what is curl?
curl is tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, POP3 etc) What can I do with curl? You can get the weather: $ curl https://wttr.in You can download hacker news $ curl https://news.ycombinator.com/ You can read a file from Github $ curl https://raw.githubusercontent.com/facebook/react/master/README.md You can even…
curl express hello world
The official express.js hello world example may crash on certain deployments that rely on a certain PORT. Make sure you use the PORT set on process.env if it is set. const PORT = process.env.PORT || 3000 Complete example (code): const express = require(‘express’) const app = express() const PORT = process.env.PORT || 3000 app.get(‘/’, (req, res) =>…
What if we build a knowledge map?
What is a core unit of knowledge? Can you map out a graph of competence based on individual nodes of ability? What does it take to implement a merge sort? Unit: Have a computer Unit: install a programming language Unit: download a text editor Unit: know how to type … etc, etc, This can possibly…
did.txt file
Goal: create an insanely simple “did” file accessible by terminal Time flies by when you’re learning how to code. Its super important to take a second every once in a while to simple write down what you did during the past mental sprint. Writing down what you learned solidifies the knowledge. Cue the did.txt file…
Set up your programming environment
*wip Must have for your Mac Get homebrew – no longer drag an icon to install Homebrew – “the missing package manager for macOS” will make it so much easier to download, upgrade and maintain your packages. It will install packages super transparently in /usr/local/Cellar/* and symlink commands to /bin. Must have for node.js nvm a…