Samba on Ubuntu, using Mac

On Ubuntu

Open the terminal and run:

sudo apt update
sudo apt install samba
sudo nano /etc/samba/smb.conf

At the end of the file, add the following lines:

   comment = Samba on Ubuntu
   path = /home/username/sambashare
   read only = no
   browsable = yes

Restart samba

sudo service smbd restart

Update firewall rules to allow Samba traffic:

sudo ufw allow samba

Set the samba password for the Ubuntu user

sudo smbpasswd -a username

On Mac:

Open finder and press COMMAND+k, this will open the window “Connect to server”, enter the URL:

PostgreSQL Ubuntu

PostgreSQL import database

Postgres login (localhost):

sudo -u postgres psql

Postgres login (external host):

psql -h EXTERNAL_HOST_IP -d DB_NAME -U postgres

Listing databases:

postgres=# \l

Switching databases:

postgres=# \c DB_NAME

Listing tables:

DB_NAME=# \dt

Creating database, user and adding access on PostgreSQL

Create a new database:

postgres=# create database DB_NAME;

Create a new database user:

postgres=# create user USER_NAME with encrypted password 'USER_PASSWORD';

Grant access on database for the user

postgres=# grant all privileges on database DB_NAME to USER_NAME

PostgreSQL import database:

sudo -u POSTGRESQL_USER psql -h HOST_IP  -d DB_NAME < SQL_FILE.sql

GIT Ubuntu

Update To Git Branch Master

Current working branch:

git branch
* master

Working on a different branch:

git checkout -b ANOTHER_BRANCH
Switched to a new branch 'ANOTHER_BRANCH'

Check if there are some new commits on master:

git checkout master
git pull

Merge changes

The easiest approach for merging the changes would be:

git checkout ANOTHER_BRANCH
git merge master

If there are differences, then merge will apply the commits to the top of ANOTHER_BRANCH and create a new merge commit. Otherwise, the merge will be resolved by a fast-forward.


git checkout ANOTHER_BRANCH
git rebase master

Rebase moves all diverging commits of ANOTHER_BRANCH to the top. The diverging commits will have new hashes because history will be rewritten. Accordingly, if you’ve previously pushed your feature branch to remote, then the only way to update it is with force push.