Skip to content

Instantly share code, notes, and snippets.

View santoshpy's full-sized avatar
🐍
Focusing

Santosh Purbey santoshpy

🐍
Focusing
View GitHub Profile

Pyenv Important Commands

1. To list available python version

pyenv install -list

2. To install specific version of python

"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@santoshpy
santoshpy / async_download_images.py
Created June 5, 2021 16:13
Python3 Download Image Asynchronously From List of URLs.
"""
To Download Image Asynchronously From List of URLs
"""
import asyncio
from pathlib import Path
import aiofiles
from aiohttp import ClientSession
@santoshpy
santoshpy / .dockerignore
Created January 16, 2021 18:58 — forked from jefftriplett/.dockerignore
How I use Docker and Compose
.*
!.coveragerc
!.env
!.pylintrc
@santoshpy
santoshpy / .pylintrc
Created September 2, 2020 06:51
pylintrc config file
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
@santoshpy
santoshpy / celery.conf
Last active June 26, 2020 15:26
Celery worker and scheduler in the background as a daemon with Supervisor.
; install supervisor > sudo apt-get install supervisor
; adding configuration files to the “/etc/supervisor/conf.d/” directory on the remote server
; ==========================
; celery worker supervisor
; ==========================
; the name of your supervisord program
[program:{{appname}}_celery]
@santoshpy
santoshpy / producer_consumer_using_thread.py
Created March 3, 2020 10:28
Python queue for multithreading, multi-thread-example
import time
import random
import threading
from queue import Queue
from threading import Thread
def crawler(queue):
while True:
@santoshpy
santoshpy / python_3.ipynb
Created May 15, 2019 01:52
things_you_are_probably_not_using_in_python_3_but_should/python 3 examples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@santoshpy
santoshpy / hello_world.py
Created February 20, 2019 07:33
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@santoshpy
santoshpy / inspect_mate.py
Created December 26, 2018 09:40 — forked from MacHu-GWU/inspect_mate.py
``inspect_mate`` provides more methods to get information about class attribute than the standard library ``inspect``.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
``inspect_mate`` provides more methods to get information about class attribute
than the standard library ``inspect``.
This module is Python2/3 compatible, tested under Py2.7, 3.3, 3.4, 3.5, 3.6.
Includes tester function to check: