Friday, April 17, 2020

6 ways to run python


Python language interpreter

Python interpreter can be used many ways from command line.

Beginners guide: https://wiki.python.org/moin/BeginnersGuide

Developers guide: https://devguide.python.org/


  •  Call a Python interactive shell (REPL):
           python
  •   Execute script in a given Python file:
           python script.py
  • Execute script as part of an interactive shell:
          python -i script.py
  •  Execute a Python expression:
          python -c "expression"
  •  Run library module as a script (terminates option list):
          python -m module arguments
  •  Interactively debug a Python script:
         python -m pdb script.py

     
8 beginners commands to start with Docker


Installation guides:


windows - https://docs.docker.com/docker-for-windows/

linux - https://docs.docker.com/engine/install/

mac - https://docs.docker.com/docker-for-mac/install/


docker basic
  1. List currently running docker containers:
    docker ps
  2. List all docker containers (running and stopped):
    docker ps -a
  3. Start a container from an image, with a custom name:
    docker run --name container_name image
  4. Start or stop an existing container:
    docker start|stop container_name
  5. Pull an image from a docker registry:
    docker pull image
  6. Open a shell inside of an already running container:
    docker exec -it container_name sh
  7. Remove a stopped container:
    docker rm container_name
  8. Fetch and follow the logs of a container:
    docker logs -f container_name

Thursday, April 16, 2020

gdb debugging - PART 2

gdb part2

gdb debugging techniques continutaion

This is a continuation from gdb part1 post -
http://naveendavisv.blogspot.com/2020/02/gdb-tips-part1.html

 - Debug an executable:
   gdb executable

 - Attach a process to gdb:
   gdb -p procID

 - Debug with a core file:
   gdb -c core executable

 - Execute given GDB commands upon start:
   gdb -ex "commands" executable

 - Start gdb and pass arguments:
   gdb --args executable argument1 argument2