Skip to content

Instantly share code, notes, and snippets.

View Chitrank-Dixit's full-sized avatar
🎯
Focusing

Chitrank Dixit Chitrank-Dixit

🎯
Focusing
View GitHub Profile
@Chitrank-Dixit
Chitrank-Dixit / celery.sh
Created December 16, 2016 08:59 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@Chitrank-Dixit
Chitrank-Dixit / installation_instructions.md
Last active November 16, 2016 10:32
Install and Configure ElasticSearch, Kibana and Sense
@Chitrank-Dixit
Chitrank-Dixit / deps.pp
Created September 12, 2016 19:25 — forked from rcrowley/deps.pp
Deploying Django with Puppet
stage { "pre": before => Stage["main"] }
class python {
package {
"build-essential": ensure => latest;
"python": ensure => "2.6.6-2ubuntu1";
"python-dev": ensure => "2.6.6-2ubuntu1";
"python-setuptools": ensure => "latest";
}
exec { "easy_install pip":
path => "/usr/local/bin:/usr/bin:/bin",
@Chitrank-Dixit
Chitrank-Dixit / crontab_cheat_sheet.md
Last active September 14, 2016 15:40
crontab cheatsheet

(specify the cronjob) after saving this it installs the specified crontab

crontab -e

to start cron

sudo service cron start

@Chitrank-Dixit
Chitrank-Dixit / base.py
Last active September 13, 2016 13:15
celery configuration for my django project
# This is the settings file
# Rabbitmq configuration
BROKER_URL = "amqp://abcd:abcd@localhost:5672/abcd"
# Celery configuration
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Asia/Kolkata'
CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend'
@Chitrank-Dixit
Chitrank-Dixit / create_python_module
Created August 22, 2016 19:01
Python Create and Upload code to the module
The python module basic commands
to clean and remove the module
$ python setup.py sdist (this command will remove the module from your systems python)
$ python setup.py install ( this command will install the module to your system's python)
$ python setup.py register ( this command will register your module to the pypi)
$ python setup.py sdist upload ( this command will upload your newer module version)

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@Chitrank-Dixit
Chitrank-Dixit / gunicorn_start.bash
Created July 31, 2016 19:03 — 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

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Chitrank-Dixit
Chitrank-Dixit / nginx.conf
Created July 17, 2016 11:54 — forked from calebwoods/nginx.conf
Sample Nginx config for deployment of Angular.js app
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}