How to push from Branch to Master in Git

How to push from a remote branch to master:

What to do if you know what you are doing or are experienced with Git:

$ git push <remote branch>:master

General format:

$ git push <remote> <local branch name>:<remote branch to push into>
For less experienced:
git checkout master
git pull               # to update the latest  master state
git merge develop      # to merge branch to master
git push origin master # push current HEAD to master

I did the second version, and was able to successfully push to master!

How to Add Line Numbers to Vim Permanently

Recently I’ve started working with a VM and I realized that debugging was a bit hard because I couldn’t see the line numbers for the code, so I searched up how you can see line numbers in vim, and found that when you are in a file with vim, press ESC, then enter the command:

:set number

The line numbers will show up. Yet, if you quit out of that session, and vi into the file again, you will see that the line numbers are gone. In order to set line numbers permanently in vim, you would need to go into your ~/.vimrc file and set properties for vim, but I noticed that in the VM I was on, there were no other directories or that file, so I created that file in my home directory by doing:

cd ~ 
vim .vimrc
set number

1st command: goes to home directory

2nd command: creates .vimrc file

3rd command: adds “set numbers” property into vimrc

4th command: saves and quits out of file

How to Query from MySQL Database in Python



import mysql.connector
mydb = mysql.connector.connect (
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM customers")
myresult = mycursor.fetchall()
for x in myresult:
import mysql.connector
mydb = mysql.connector.connect (
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM customers")
myresult = mycursor.fetchone()
for x in myresult:
I also did notice something quite peculiar when I printed out the data received from fetchone() or fetchall(). It seemed to be a tuple format, and when I tried to index for each element of the data or indexing for each element (such as data[0]), I received it in this format: (‘entry’,) which was difficult to parse. Therefore, I had to parse again just for the first element: data[0][0] to get the actual entry and data from the database I needed.
Note: This only works if you are searching for 1 column.

Python UUID

Generating UUID in Python:

>>> import uuid

>>> # make a UUID based on the host ID and current time
>>> uuid.uuid1()

>>> # make a UUID using an MD5 hash of a namespace UUID and a name
>>> uuid.uuid3(uuid.NAMESPACE_DNS, '')

>>> # make a random UUID
>>> uuid.uuid4()

>>> # make a UUID using a SHA-1 hash of a namespace UUID and a name
>>> uuid.uuid5(uuid.NAMESPACE_DNS, '')

>>> # make a UUID from a string of hex digits (braces and hyphens ignored)
>>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')

>>> # convert a UUID to a string of hex digits in standard form
>>> str(x)

>>> # get the raw 16 bytes of the UUID
>>> x.bytes

>>> # make a UUID from a 16-byte string
>>> uuid.UUID(bytes=x.bytes)

Installing Postgres on MacOS with Brew

This is what I followed to install postgres:


brew doctor
brew update


brew install postgres
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

Create aliases:

alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
  1. alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"

This alias is only set for that terminal window, so to set this permanently, find your shell path by:

  1. echo $SHELL

Then you can append the alias to the computer shell file. For me, this was ~/.zshrc

Note: Make sure to echo the alias and use “>>” to append, not “>” which completely wipes the file with the text. This is what I did, and unfortunately, all the past things I added to my shell file were erased and it could not be undone.


Installing flask-mysqldb (Debug and Solution)

In this post, I will go through how I was able to install flask-mysqldb after going through lots of trial and error. I wanted to install flask-mysqldb to connect the Flask API to the MySQL database we were planning on using.

To install flask-mysqldb, the command to run is:

pip install flask_mysqldb

Yet, when I ran it, I kept receiving these errors:

[email protected] ~ % pip install flask_mysqldb
Collecting flask_mysqldb
  Using cached Flask-MySQLdb-0.2.0.tar.gz (2.1 kB)
Collecting Flask>=0.10
  Using cached Flask-1.1.2-py2.py3-none-any.whl (94 kB)
Collecting mysqlclient
  Using cached mysqlclient-1.4.6.tar.gz (85 kB)
    ERROR: Command errored out with exit status 1:
     command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/ -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/__/j8b0d7wn7_796hd4c4x56f040000gn/T/pip-install-rCiijx/mysqlclient/'"'"'; __file__='"'"'/private/var/folders/__/j8b0d7wn7_796hd4c4x56f040000gn/T/pip-install-rCiijx/mysqlclient/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/__/j8b0d7wn7_796hd4c4x56f040000gn/T/pip-pip-egg-info-0D9Xsz
         cwd: /private/var/folders/__/j8b0d7wn7_796hd4c4x56f040000gn/T/pip-install-rCiijx/mysqlclient/
    Complete output (12 lines):
    sh: mysql_config: command not found
    sh: mariadb_config: command not found
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/__/j8b0d7wn7_796hd4c4x56f040000gn/T/pip-install-rCiijx/mysqlclient/", line 16, in <module>
        metadata, options = get_config()
      File "", line 61, in get_config
        libs = mysql_config("libs")
      File "", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    EnvironmentError: mysql_config not found
ERROR: Command errored out with exit status 1: python egg_info Check the logs for full command output.

In the error, it indicated that  mysql_config: command not found so I found this thread referring to it in my search:

In the thread, it mentions to use  apt-get but I had trouble running this command in terminal, and I learned that  apt-get is only for debian and ubuntu, whereas yum is for centos/fedora/redhat distribution. I decided to use brew which is a 3rd party community doing unix-like things on macOS.

When I attempted to install with brew using this command:

brew install mysql-client

I received these errors:

mysql-client is keg-only, which means it was not symlinked into /usr/local,
because it conflicts with mysql (which contains client libraries).If you need to have mysql-client first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrcFor compilers to find mysql-client you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql-client/include"

Which essentially tells me to put it into my .zshrc folder. That is done through this command:

echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc

This briefly translates to:

“Please update my STARTUP config, and when I start a new terminal, in that terminal, update my PATH”

Note: Just editing .zhrc does not affect current window

Afterwards, a new terminal must be opened (my previous mistake with checking in the same terminal window and being confused that no path had been added) in order to check the path with:

echo $PATH

I was able to see the path added after:

(base) [email protected] ~ % echo $PATH

Afterwards, when I tried to install flask-mysqldb with the command:

pip install flask-mysqldb

It worked and installed flask-mysqldb successfully! Afterwards, I was able to run the flask program I had built!

This took me hours of stack overflow,  so hopefully it’s helpful for those who have run into the same problem with installing flask-mysqldb!


Github SSH Key

Recently, I tried to clone a repository I was working on in GitHub that I had created, but I received the following error:

Permission denied (publickey).
fatal: Could not read from remote repository.Please make sure you have the correct access rights
and the repository exists.

Apparently, I needed to create an SSH key and add it to Github SSH Keys in order to access the repository. To do this, I followed these instructions (on

Generate SSH key using ssh-keygen -t rsa -b 4096 -C "[email protected]".
Copy the output of cat
Paste the above copied output into your Github profile -> Settings -> SSH and GPG Keys -> Add new SSH key

Regarding this, I created an SSH key, but couldn’t find it, so I ended up following the path: /Users/jessicapeng/.ssh/ and I ran command cat .ssh/ once I was in the directory jessicapeng in order to get it. Then, I followed the instructions and went to my Github Profile > Settings> SSH and GPG Key > Add SSH Key. And afterwards, I was able to successfully clone it and use git with it!