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
su root | |
# Don't you hate when you need to root to fix dumb issues? | |
service network-manager stop | |
rm /var/lib/NetworkManager/NetworkManager.state | |
service network-manager start | |
reboot -h now |
#! /usr/bin/python | |
# a simple tcp server | |
import socket,os | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.bind(('127.0.0.1', 12345)) | |
sock.listen(5) | |
while True: | |
connection,address = sock.accept() | |
buf = connection.recv(1024) | |
print buf |
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
""" | |
Selenium webdriver + BrowserMob proxy example | |
First, you have to download browsermob: | |
wget --no-check-certificate https://s3-us-west-1.amazonaws.com/lightbody-bmp/browsermob-proxy-2.0-beta-9-bin.zip | |
unzip inside the directory you are running this | |
pip install selenium browsermob-proxy |
#!/usr/bin/env groovy | |
/** | |
* Demonstrates how to use Grape to grab dependencies for | |
* Groovy scripts. | |
* | |
* Grape stands for the Groovy Adaptable (Advanced) Packaging Engine, and it is a part of the Groovy installation. | |
* Grape helps you download and cache external dependencies from within your script with a set of simple annotations. | |
* | |
* If, in your script, you require an external dependency, that you know is available in a public repository as Maven Central Repository, |
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.
" Don't try to be vi compatible | |
set nocompatible | |
" Helps force plugins to load correctly when it is turned back on below | |
filetype off | |
" TODO: Load plugins here (pathogen or vundle) | |
" Turn on syntax highlighting | |
syntax on |
// | |
// Write the mock request payload to a file for checking later... | |
// newWrite() is the important it to ensure you get a *new* file each time. | |
// | |
def filename = "C:\\MyScratchFolder\\soapUI projects\\Testing\\procon\\mock_po_activity_request.xml" | |
def file = new File(filename) | |
def w = file.newWriter() | |
w << mockRequest.requestContent | |
w.close() |
xhost + ${hostname}
to allow connections to the macOS host *export HOSTNAME=`hostname`
* environment:
Info: https://www.nginx.com/resources/admin-guide/nginx-https-upstreams/
Source: http://nategood.com/client-side-certificate-authentication-in-ngi
This is SSL, so you'll need an cert-key pair for you/the server, the api users/the client and a CA pair. You will be the CA in this case (usually a role played by VeriSign, thawte, GoDaddy, etc.), signing your client's certs. There are plenty of tutorials out there on creating and signing certificates, so I'll leave the details on this to someone else and just quickly show a sample here to give a complete tutorial. NOTE: This is just a quick sample of creating certs and not intended for production.