Skip to content

Instantly share code, notes, and snippets.

View Riyas3's full-sized avatar

Riyasutheen Abdul Rahman Riyas3

View GitHub Profile
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- repo: https://gitlab.com/pycqa/flake8
@Riyas3
Riyas3 / gunicorn_start.bash
Created November 25, 2021 16:17 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@Riyas3
Riyas3 / rabbitmq.txt
Created September 1, 2020 18:19 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
; ==================================
; celery worker supervisor
; ==================================
[program:celery]
command=/path/to/home/.virtualenvs/celery_env/bin/celery worker -A app.celery --loglevel=INFO
directory=/path/to/home/celery-scheduler
user=root
numprocs=1
@Riyas3
Riyas3 / README.md
Created July 26, 2020 20:16 — forked from mau21mau/README.md
Configure Celery + Supervisor With Django
@Riyas3
Riyas3 / curl.md
Created July 4, 2020 07:52 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Riyas3
Riyas3 / celery.py
Created January 23, 2020 06:12 — forked from Lh4cKg/celery.py
Installing And Configuration Django 1.10 && Celery 4.0.2 && RabbitMQ
1. django (latest version)
$ pip install django
2. celery (latest version)
$ pip install celery
first steps
docs: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
install celery extension
$ pip install django-celery-beat
docs: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#django-celery-beat

Source: https://www.toptal.com/python/tips-and-practices

This resource contains a collection of Python best practices and Python tips provided by our Toptal network members. As such, this page will be updated on a regular basis to include additional information and cover emerging Python techniques. This is a community driven project, so you are encouraged to contribute as well, and we are counting on your feedback.

Python is a high level language used in many development areas, like web development (Django, Flask), data analysis (SciPy, scikit-learn), desktop UI (wxWidgets, PyQt) and system administration (Ansible, OpenStack). The main advantage of Python is development speed. Python comes with rich standard library, a lot of 3rd party libraries and clean syntax. All this allows a developer to focus on the problem they want to solve, and not on the language details or reinventing the wheel.

Check out the Toptal resource pages for additional information on Python. There is a Python hiring guide, Python job

Cheatsheet for Django QuerySets

Current Django Version: 2.2

Methods that return new QuerySets

Can be chained:

Entry.objects.filter(**kwargs).exclude(**kwargs).order_by(**kwargs)