This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WSGIPythonPath /home/ubuntu/your-repo/venv/lib/python3.6/site-packages | |
<VirtualHost *:80> | |
# The ServerName directive sets the request scheme, hostname and port that | |
# the server uses to identify itself. This is used when creating | |
# redirection URLs. In the context of virtual hosts, the ServerName | |
# specifies what hostname must appear in the request's Host: header to | |
# match this virtual host. For the default virtual host (this file) this | |
# value is not decisive as it is used as a last resort host regardless. | |
# However, you must set it for any further virtual host explicitly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
WSGI config for a django project. | |
It exposes the WSGI callable as a module-level variable named ``application``. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ | |
""" | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[supervisord] | |
environment=SOME_ENV_VAR="blah",ANOTHER_ENV_VAR="blah" | |
[program:flower] | |
command=/home/ubuntu/venv/bin/flower -A projName --port=5555 | |
directory=/home/ubuntu/projName | |
autostart=true | |
autorestart=true | |
stderr_logfile=/var/log/flower-supervisor.err.log | |
stdout_logfile=/var/log/flower-supervisor.out.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.decorators import periodic_task | |
from datetime import timedelta | |
@periodic_task(run_every=(timedelta(seconds=10)), name="my_task", ignore_result=True) | |
def my_task(): | |
return "success" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imaplib | |
mail = imaplib.IMAP4_SSL('imap.gmail.com') | |
mail.login(os.environ["EMAIL_USER"], os.environ["EMAIL_PASS"]) | |
def handle_text(): | |
mail.list() | |
# List of "folders" aka labels in gmail. | |
mail.select("inbox") | |
result, data = mail.search(None, "ALL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"aps": { | |
"alert": { | |
"title": "Comment mention", | |
"body": "Comment mention body", | |
}, | |
"badge": 1 | |
}, | |
"Simulator Target Bundle": "bundle_id.com", | |
"push_type": "comment", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filter a list of dicts by a dynamic number of conditions (which is a dict of key/vals) | |
# If you pass a list as a filter value, it will be treated as an OR condition | |
list_of_dicts = [{"name": "Steve", "age": 29}, {"name": "John", "age": 99}] | |
filter_conditions = {"name": "Steve", "age": [18, 29]} # Would return 1 result | |
filtered_records = list(filter( | |
lambda record: all(( | |
# If the value is a list, filter for any values in that list (i.e. OR condition) | |
record[filter_key] in filter_value |