F U Python Commands

The previous post was for commands Unix. This post is about the Python commands I use or Google frequently. To find the absolute path of the directory of the current file being executed - abs_path = os.path.dirname(os.path.realpath(file)) To copy a file from source to destination (using shutil)- from shutil import copyfile copyfile(src, dst) To copy a file or directory from source to destination (using shutil)- from shutil import copy copy(src, dst) ...

January 9, 2019 · 1 min · Abhiram R

Unix Commands I Use

I keep Googling commands for some of these situations regularly - General - 1) To find files one level below your current directory - I was trying to find which repos in my set of folders have a setup.py file. So, this is what I’d use. find . -maxdepth 2 -iname setup.py 2) To find what process is running on port 2181 - sudo lsof -n -i :2181 | grep LISTEN ...

December 24, 2018 · 1 min · Abhiram R

Nginx Gunicorn Ref Links

So, I looked up a lot of links while learning how to configure Gunicorn and Nginx for a Flask app I’m building. An article on the specifics of what I learnt will follow this one. This one focuses on the links and resources themselves - First of all, you’re probably asking - Why do I need Gunicorn and Nginx? That’s what I looked up first as well. https://serverfault.com/questions/331256/why-do-i-need-nginx-and-something-like-gunicorn Next, how to actually go about the whole process? The obvious links: - https://gunicorn.org/#quickstart - https://www.linode.com/docs/web-servers/nginx/how-to-configure-nginx/ - http://nginx.org/en/docs/beginners_guide.html - https://www.fullstackpython.com/green-unicorn-gunicorn.html ...

October 1, 2018 · 2 min · Abhiram R