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
import collections | |
import sys | |
# setup the graph | |
G = { | |
1:set([ 2, 3, 5, 6,]), | |
2:set([ 1, 4,]), | |
3:set([ 1, 6, 7,]), | |
4:set([ 2, 5, 7, 8,]), | |
5:set([ 1, 4, 6, 8, 9, 10,]), |
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
% networked ping | |
% -- | |
% Open firewall ports 4369 (erlang port mapper) and 9100-9105 (communication ports) | |
% | |
% On node 1 start your shell with this command: | |
% erl -name [email protected] -setcookie cook -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9105 | |
% | |
% On node 2 start your shell with this command: | |
% erl -name [email protected] -setcookie cook -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9105 | |
% |
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 socket | |
import threading | |
import select | |
import sys | |
terminateAll = False | |
class ClientThread(threading.Thread): |
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 | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
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
import socket | |
if __name__ == "__main__": | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(("localhost", 9000)) | |
data = "some data" | |
sock.sendall(data) | |
result = sock.recv(1024) | |
print result | |
sock.close() |
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
from grab import Grab, GrabError | |
from multiprocessing.dummy import Pool as ThreadPool | |
import time | |
def load_proxy_list(filepath): | |
f = open(filepath) | |
proxy_list = f.read().splitlines() | |
f.close() | |
return proxy_list |
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
# If /json route receives header "application/json" | |
@app.route("/json", methods=['GET','POST']) | |
def json(): | |
app.logger.debug("JSON received...") | |
app.logger.debug(request.json) | |
if request.json: | |
mydata = request.json # will be |
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
#!flask/bin/python | |
from flask import Flask, jsonify, abort, request, make_response, url_for | |
from flask.ext.httpauth import HTTPBasicAuth | |
app = Flask(__name__, static_url_path = "") | |
auth = HTTPBasicAuth() | |
@auth.get_password | |
def get_password(username): | |
if username == 'miguel': |
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
auth_basic "Restricted"; | |
auth_basic_user_file /etc/nginx/htpasswd; |
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
from twisted.web.proxy import Proxy, ProxyRequest | |
from twisted.internet.protocol import Protocol, ClientFactory | |
import urlparse | |
from twisted.python import log | |
class ConnectProxyRequest(ProxyRequest): | |
"""HTTP ProxyRequest handler (factory) that supports CONNECT""" | |
connectedProtocol = None |
OlderNewer