#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
.idea/* | |
*.pyc |
1. Make sure you have the following requisites | |
- Debian or Ubuntu | |
- Postgresql | |
- Python | |
- Tryton | |
2. Install requisite software | |
2.1 apt-get install python-pip python-lxml python-relatorio python-psycopg2 posgresql python-tz |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
====================================== | |
Setting up Nginx, uWSGI and Python3 | |
====================================== | |
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
1) Only showed you how to run the server for a single web application. | |
2) Only showed you how to configure the app, not the server it was running on. | |
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
from random import choice | |
from string import ascii_lowercase, digits | |
from django.contrib.auth.models import User | |
def generate_random_username(length=16, chars=ascii_lowercase+digits, split=4, delimiter='-'): | |
username = ''.join([choice(chars) for i in xrange(length)]) | |
if split: | |
username = delimiter.join([username[start:start+split] for start in range(0, len(username), split)]) |
#!/bin/bash | |
# | |
# Shell script to automatically configure a new Flask, nginx and uWSGI based blog | |
# on an Amazon EC2 instance. | |
# | |
# See http://bit.ly/MeGwjD for more information! | |
# | |
# If you are forking this for your own custom configuration script, see the following other gists: | |
# https://gist.github.com/3071737 | |
# https://gist.github.com/3071739 |
description "uWSGI" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
env UWSGI=/usr/bin/uwsgi | |
env LOGTO=/var/log/uwsgi/emperor.log | |
exec $UWSGI --master --emperor /etc/uwsgi/apps-enabled --die-on-term --uid nginx --gid nginx --logto $LOGTO |