Show git Branch in Linux/mac terminal.

Show git Branch in Linux/mac terminal.

Add this line ate the end of the ˜/.bash_profile #————————- parse_git_branch() { git branch 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* \(.*\)/ (\1)/’ } export PS1=”\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ “

Git Workflow

Git Workflow

https://medium.com/@talgoldfus/better-understanding-gits-work-flow-in-order-to-properly-deal-with-merge-conflicts-part-i-760a366fc997#:~:text=Whats%20the%20difference%20between%20push,refs%20along%20with%20associated%20objects%E2%80%9D.

Multi Factor authentication, MFA Amazon AWF.

Multi Factor authentication, MFA Amazon AWF.

{ “Version”: “2012-10-17”, “Statement”: [ { “Sid”: “AllowViewAccountInfo”, “Effect”: “Allow”, “Action”: [ “iam:GetAccountPasswordPolicy”, “iam:GetAccountSummary”, “iam:ListVirtualMFADevices”, “iam:ListUsers” ], “Resource”: “*” }, { “Sid”: “AllowManageOwnPasswords”, “Effect”: “Allow”, “Action”: [ “iam:ChangePassword”, “iam:GetUser” ], “Resource”: “arn:aws:iam::*:user/${aws:username}” }, { “Sid”: “AllowManageOwnAccessKeys”, “Effect”: “Allow”, “Action”: [ “iam:CreateAccessKey”, “iam:DeleteAccessKey”, “iam:ListAccessKeys”, “iam:UpdateAccessKey” ], “Resource”: “arn:aws:iam::*:user/${aws:username}” }, { “Sid”: “AllowManageOwnSigningCertificates”, “Effect”: “Allow”, “Action”: [ “iam:DeleteSigningCertificate”, “iam:ListSigningCertificates”, “iam:UpdateSigningCertificate”, “iam:UploadSigningCertificate” ], “Resource”: “arn:aws:iam::*:user/${aws:username}” }, { “Sid”: “AllowManageOwnSSHPublicKeys”, “Effect”: “Allow”, “Action”: [ “iam:DeleteSSHPublicKey”, “iam:GetSSHPublicKey”, “iam:ListSSHPublicKeys”, “iam:UpdateSSHPublicKey”, “iam:UploadSSHPublicKey” ], “Resource”: “arn:aws:iam::*:user/${aws:username}” }, {…

Read More Read More

How to handle linux commands and linux output process with Python.

How to handle linux commands and linux output process with Python.

In Python, often you may want to execute linux command and get the output of the command as string variable. There are multiple ways to execute shell command and get output using Python. A naive way to do that is to execeute the linux command, save the output in file and parse the file. 1 import oscmd = ‘wc -l my_text_file.txt > out_file.txt’os.system(cmd) Get output from shell command using subprocess A better way to get the output from executing a…

Read More Read More

Install my LAMP on ubuntu 18.

Install my LAMP on ubuntu 18.

1 apt-get update2 chmod 0600 /var/swapfile3 mkswap /var/swapfile4 swapon /var/swapfile10 vi /etc/fstab11 add to fstab: /var/swapfile swap swap defaults 0 012 mysql -u root -h localhost -p13 mysql -u root -h localhostmysql> use mysql;UPDATE user set plugin=’mysql_native_password’ where user=’root’;ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘newpassword’;FLUSH PRIVILEGES;quit24 Install PHP 7.325 apt install software-properties-common26 add-apt-repository ppa:ondrej/php27 apt install php7.3 php7.3-common php7.3-opcache php7.3-cli php7.3-gd php7.3-curl php7.3-mysql28 php -v 29 adduser webmaster, user of the folder /home/webmaster in order to be used by…

Read More Read More

Some AWS fix for LAMP installation.

Some AWS fix for LAMP installation.

MYSQL: to connect locally from a linux user to mysql using the root mysql user. From root linux account, mysql -u root -h localhost -p, mysql> use mysql; UPDATE user set plugin=’mysql_native_password’ where user=’root’; ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘newpassword’; FLUSH PRIVILEGES; quit Apache2: sometime the apache just broke with a mutex error. add to apache2.conf Mutex posixsem Mysql: sometimes broke because have not enough memory, in that case add a swapfile, aws doesn’t offer swap by default…

Read More Read More