Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
| """ | |
| Copyright (c) 2009, Sean Creeley | |
| All rights reserved. | |
| Redistribution and use in source and binary forms, with or without modification, | |
| are permitted provided that the following conditions are met: | |
| * Redistributions of source code must retain the above copyright notice, this | |
| list of conditions and the following disclaimer. | |
| * Redistributions in binary form must reproduce the above copyright notice, |
| <!DOCTYPE html> | |
| <html lang="en"> <!-- Set this to the main language of your site --> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>HTML5</title> | |
| <!-- Enter a brief description of your page --> | |
| <meta name="description" content=""> | |
| <!-- Define a viewport to mobile devices to use - telling the browser to assume that the page is as wide as the device (width=device-width) and setting the initial page zoom level to be 1 (initial-scale=1.0) --> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <!-- Add normalize.css which enables browsers to render all elements more consistently and in line with modern standards as it only targets particular styles that need normalizing --> |
| from shutil import make_archive | |
| from django.core.servers.basehttp import FileWrapper | |
| def download(request,file_name=""): | |
| """ | |
| A django view to zip files in directory and send it as downloadable response to the browser. | |
| Args: | |
| @request: Django request object | |
| @file_name: Name of the directory to be zipped | |
| Returns: | |
| A downloadable Http response |
| [supervisord] | |
| nodaemon=true | |
| loglevel=debug | |
| [program:amon] | |
| command=gunicorn -c gunicorn.conf.py wsgi | |
| directory=/amon | |
| autostart=true | |
| autorestart=true | |
| redirect_stderr=true |
| #!/bin/bash | |
| # | |
| # Use RabbitMQ admin plugin to monitor backed up queues. If `THRESHOLD` is | |
| # exceeded, an error list will be served at 127.0.0.1:1334/overage.txt. If | |
| # all queues are below the threshold, requests for the overage file should | |
| # expect a 404. | |
| # API host, user, and password | |
| HOST=127.0.0.1:15672 | |
| USER=admin |
| /* 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.#'), |
This is a crash course in JavaScript. It is intended for people who already have a bit of programming experience in other languages.
This will hopefully give a basic idea of the most-commonly-used language features, but it is not indended to be a comprehensive guide.
This guide was last updated in August 2016.
To declare a variable called foo:
| def strictly_increasing(L): | |
| """Returns TRUE if the values in the list are strictly increasing | |
| Always increasing; never remaining constant or decreasing or null. | |
| """ | |
| return all(x<y for x, y in zip(L, L[1:])) | |
| def strictly_decreasing(L): | |
| """Returns TRUE if the values in the list are strictly decreasing | |
| Always decreasing; never remaining constant or increasing or null. |