------------------------------- ------------------ Django --------------------
| Browser: GET /udo/contact/2 | === wsgi/fcgi ===> | 1. Asks OS for DJANGO_SETTINGS_MODULE |
------------------------------- | 2. Build Request (from wsgi/fcgi callback) |
| 3. Get settings.ROOT_URLCONF module |
| 4. Resolve URL/view from request.path | # url(r'^udo/contact/(?P<id>\w+)', view, name='url-identifier')
| 5. Apply request middlewares | # settings.MIDDLEWARE_CLASSES
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
# create pipe, tail it, and read from stdin in a program | |
mkfifo namedPipe; tail -f namedPipe | while true; do read msg; echo $msg; done; | |
# now send messages from another shell | |
echo "start" > namedPipe | |
echo "stop" > namedPipe | |
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
#!/bin/sh | |
# This is a skeleton of a bash daemon. To use for yourself, just set the | |
# daemonName variable and then enter in the commands to run in the doCommands | |
# function. Modify the variables just below to fit your preference. | |
daemonName="DAEMON-NAME" | |
pidDir="." | |
pidFile="$pidDir/$daemonName.pid" |
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
# Template: A.html | |
<html> | |
<head></head> | |
<body> | |
{% block hello %} | |
HELLO | |
{% endblock %} | |
</body> | |
</html> |
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
# Next time you need to install something with python setup.py -- which should be never but things happen. | |
python setup.py install --record files.txt | |
# This will cause all the installed files to be printed to that directory. | |
# Then when you want to uninstall it simply run; be careful with the 'sudo' | |
cat files.txt | xargs sudo rm -rf | |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
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
#!/usr/bin/env python | |
import sqlite3 | |
class dbopen(object): | |
""" | |
Simple CM for sqlite3 databases. Commits everything at exit. | |
""" | |
def __init__(self, path): | |
self.path = path |
Tested on Ubuntu 16.04 Docker container. The Dockerfile is a single line FROM ubuntu:16.04
.
NOTE: stopping services didn't work for me for some reason. That's why there is pidof <service name> | xargs kill
after each failed service <service name> stop
to kill it.