SSH tunneling and port forwarding snippets and utils
| #!/usr/bin/python | |
| import os, sys | |
| import random | |
| import time | |
| import string | |
| import mysql.connector | |
| import threading | |
| from mysql.connector import errorcode |
| import time | |
| import psycopg2 | |
| from iter_file import IteratorFile | |
| conn = psycopg2.connect(host="localhost", database="test") | |
| # args = [(1,2), (3,4), (5,6)] | |
| args = [(i,i+1) for i in range(1,1*10**4,2)] |
| # Versions: | |
| # Vagrant: 1.8.1 | |
| # Ubuntu: 14.04 | |
| # uWSGI: 2.0.12 | |
| # Nginx: 1.8.1 | |
| # Python: 2.7.6, 3.5.1 | |
| # Flask: 0.10.1 | |
| # MariaDB: 5.5.46 | |
| # My computer: MacOSⅩ 10.10.5 (Yosemite) | |
| # VM: VirtualBox 5.0.14 |
In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So ⌘ + D does not mean hold shift. ⌘ + Shift + D does of course.
| Function | Shortcut |
|---|---|
| New Tab | ⌘ + T |
| Close Tab or Window | ⌘ + W (same as many mac apps) |
| Go to Tab | ⌘ + Number Key (ie: ⌘2 is 2nd tab) |
| Go to Split Pane by Direction | ⌘ + Option + Arrow Key |
Moved to git repository: https://github.com/denji/nginx-tuning
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 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading 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.