Tuesday, 19 July 2016

Ubuntu get wifi password

cd etc/NetworkManager/system-connections/ 

sudo cat WIFI_SSID_Name  

“psk”=”PASSWORD”

Monday, 18 July 2016

Heroku Django Commands

Useful commands:
  • heroku run python manage.py migrate
  • heroku config:set DISABLE_COLLECTSTATIC=1

Initialize repo

clone your existing repo from git, remove .git and do following


$ cd my-project/
$ git init
$ heroku git:remote -a quickorders
 
Login to remote shell
$ heroku run bash 


References:
  • https://devcenter.heroku.com/articles/getting-started-with-python#push-local-changes
  • https://devcenter.heroku.com/articles/deploying-python
  • https://devcenter.heroku.com/articles/django-app-configuration


Tips:
  • Do "git push" migrations files


Friday, 15 July 2016

Django with docker


Create super user for django website
docker-compose run website python manage.py createsuperuser

 here website is the name of image


Run custom command in an image
docker run --rm -i -t --entrypoint=/bin/bash albums_website:latest

This will show following promot,
root@618a92c1d9c9:/code# python manage.py <command>



Run
Run the docker-compose up command.


Thursday, 14 July 2016

git commands

Initial Setup
git config --global user.name "John Doe"
git config --global user.email "johndoeabc123@gmail.com"
git config --list


1. Undo Last commit
$ git reset --soft HEAD~1

2. Delete a local branch
$ git branch -d the_local_branch

3. Delete without merging
$ git branch -D the_local_branch

4. Checking logs
$ git log --oneline
$ git log some-file.cpp
$ git log --oneline some-file.cpp
$ git log --author "Navjot Singh"
$ git log --since=12-18-1979
   (mm-dd-yyyy)
$ git log --author "Navjot Singh" --since=12-18-1979
$ git log --since=12-18-1979 --until=12-30-2016

5. Line changed/added/deleted between 2 commits
$ git diff --stat 36baf22 6edb550

6. Diff between two commits
$ git diff 36baf22 6edb550

Docker Devops Commands

Build images
$ docker-compose build
$ docker-compose build --no-cache

Show list of docker-compose processes
$ docker-compose ps                
$ docker ps -a 
$ docker stats [container name]

Remove all docker containers
$ docker rm $(docker ps -a -q)

Remove all docker images
$ docker rmi $(docker images -q)

Show All Images
$ sudo docker images

Some general commands
$ service docker start
$ service docker stop
$ service docker restart

$ docker-compose --version


Run
Run the docker-compose up command.



Edit a container

1. Login to container's shell with root user
$ docker run -it -u root web:latest /bin/bash

You will see a prompt like:
root@78e82f680994$

2. Make you changes in files etc.

3. Exit from shell

 $ exit

4. Commit changes in the container

$ docker commit <container ID> web:latest

here container id is  78e82f680994

so the command will br
$docker commit 78e82f680994 web:latest