GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.
from django import forms | |
from app.models import User | |
from django.contrib.auth.hashers import check_password | |
from django.db.models import Q | |
class SignInForm(forms.Form): | |
username = forms.CharField(max_length=User._meta.get_field('email').max_length) | |
password = forms.CharField(min_length=6, max_length=16, widget=forms.PasswordInput()) |
So you want to create a pex that packages your script and its dependencies?
Ok - first to make our script! Call it foo.py:
import requests
if __name__ == '__main__':
req = requests.get("https://raw.githubusercontent.com/pantsbuild/pex/master/README.rst")
print req.text.split("\n")[0]
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'root': { | |
'level': 'DEBUG', | |
'handlers': ['console', ], | |
}, | |
'filters': { | |
'require_debug_false': { | |
'()': 'django.utils.log.RequireDebugFalse' |
#!/bin/bash | |
### VARIABLES ### | |
PRE_PACK="gcc gcc-c++ make pcre-devel zlib-devel unzip wget" | |
OPT_PACK="openssl-devel" | |
VER="1.5.12" | |
PREV_VER="1.5.11" | |
USER="nginx" | |
GROUP="nginx" | |
INSTALL_DIR="/etc/nginx" |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2xIntel Xeon with HT enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
First, you will need to install nginx, my way to install nginx is compiling it from source, but for now we will use apt-get
package main | |
import ( | |
"fmt" | |
"http" | |
"io/ioutil" | |
"os" | |
) | |
func main() { |
package main | |
import ( | |
"fmt" | |
"runtime" | |
"time" | |
) | |
var ( | |
INTERVAL_SEC = 10 |
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/ | |
wget http://ftp.nluug.nl/os/Linux/distr/archlinux/iso/2016.01.01/archlinux-bootstrap-2016.01.01-x86_64.tar.gz | |
# Make sure you'll have enough entropy for pacman-key later. | |
apt-get install haveged | |
# Install the arch bootstrap image in a tmpfs. | |
mount -t tmpfs none /mnt | |
cd /mnt | |
tar xvf ~/archlinux-bootstrap-2016.01.01-x86_64.tar.gz --strip-components=1 |