https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
| [ | |
| { | |
| "upazila": "Amtali Upazila", | |
| "district": "Barguna", | |
| "division": "Barisal" | |
| }, | |
| { | |
| "upazila": "Bamna Upazila", | |
| "district": "Barguna", | |
| "division": "Barisal" |
| import requests | |
| API_ENDPOINT = "https://translate.google.com/translate_tts" | |
| headers = {'User-Agent': "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0"} | |
| text = "good morning" | |
| params = { |
| # maximum capability of system | |
| user@ubuntu:~$ cat /proc/sys/fs/file-max | |
| 708444 | |
| # available limit | |
| user@ubuntu:~$ ulimit -n | |
| 1024 | |
| # To increase the available limit to say 200000 | |
| user@ubuntu:~$ sudo vim /etc/sysctl.conf |
| Add the `replication` section to the mongod.conf file: | |
| ``` | |
| $cat /usr/local/etc/mongod.conf | |
| systemLog: | |
| destination: file | |
| path: /usr/local/var/log/mongodb/mongo.log | |
| logAppend: true | |
| storage: | |
| engine: mmapv1 |
| Install and configure Apache Kafka on Ubuntu 16.04 | |
| 1. Install Java (JDK8):: | |
| Add the repository | |
| $ sudo add-apt-repository -y ppa:webupd8team/java | |
| Update the metadata of the new repository and install JDK |
| # Install R + RStudio on Ubuntu 16.04 | |
| sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E084DAB9 | |
| # Ubuntu 12.04: precise | |
| # Ubuntu 14.04: trusty | |
| # Ubuntu 16.04: xenial | |
| # Basic format of next line deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <enter your ubuntu version>/ | |
| sudo add-apt-repository 'deb https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/' | |
| sudo apt-get update |
https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
# referecing: # https://www.digitalocean.com/community/tutorials/how-to-install-apache-kafka-on-ubuntu-14-04 # https://chongyaorobin.wordpress.com/2015/07/08/step-by-step-of-install-apache-kafka-on-ubuntu-standalone-mode/
$ sudo useradd kafka -m
| #!/usr/bin/env python | |
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import pika | |
| import sys | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| host='localhost')) | |
| channel = connection.channel() | |
| message = ' '.join(sys.argv[1:]) or "Hello World!" |