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 python3 | |
import sys, os, socket | |
from socketserver import ThreadingMixIn | |
from http.server import SimpleHTTPRequestHandler, HTTPServer | |
HOST = socket.gethostname() | |
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer): | |
pass |
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
version: '2' | |
services: | |
consul: | |
image: consul | |
volumes: | |
- ./data/consul:/consul/data | |
command: /bin/consul agent -server -data-dir="/consul/data" -bootstrap -client="0.0.0.0" -advertise="127.0.0.1" -ui | |
ports: | |
- 80:8500 #HTTP API/UI | |
- 53:8600/udp #DNS |
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
# tested with HAProxy 2.0 LTS on Debian 9 | |
global | |
stats socket /tmp/haproxy_admin.sock mode 660 level admin expose-fd listeners | |
stats timeout 30s | |
user haproxy | |
group haproxy | |
defaults | |
mode http | |
maxconn 500 |
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 python3 | |
import http.server, socketserver, socket, ssl | |
PORT = 443 | |
HOST = socket.gethostname() | |
Handler = http.server.SimpleHTTPRequestHandler | |
https = socketserver.TCPServer(("0.0.0.0", PORT), Handler) | |
https.socket = ssl.wrap_socket(https.socket, keyfile='/path/to/keyfile.key', certfile='/path/to/certfile.crt', server_side=True, ssl_version=ssl.PROTOCOL_TLSv1_2, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True, ciphers='ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK') |
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 python3 | |
import sys, os, socket, ssl | |
from socketserver import ThreadingMixIn | |
from http.server import SimpleHTTPRequestHandler, HTTPServer | |
HOST = socket.gethostname() | |
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer): | |
pass |
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
# apt-get install -y imagemagick tesseract-ocr tesseract-ocr-eng python-pip | |
# pip install Image pytesseract | |
# python convert.py 2 captcha.png captcha-clean.png | |
# convert captcha-clean.png -resize 500 captcha-clean-big.png | |
# tesseract -c tessedit_char_whitelist=abcdefghijklmnopqrstuvwxyz1234567890 -psm 7 captcha-clean-big.png output | |
# cat output.txt |
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
[ | |
{ | |
"name": "Alabama", | |
"abbreviation": "AL" | |
}, | |
{ | |
"name": "Alaska", | |
"abbreviation": "AK" | |
}, | |
{ |
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 node-fetch module | |
const fetch = require("node-fetch"); | |
// return user-agent from request | |
const userAgent = fetch("https://httpbin.org/user-agent") | |
.then((response) => response.json()) | |
.then((response) => response); | |
// return origin IP from request | |
const originIP = fetch("https://httpbin.org/ip") |
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 asyncio | |
import aiohttp | |
my_urls = [ | |
'https://www.google.com/', | |
'https://www.youtube.com/', | |
'https://www.facebook.com/', | |
'https://www.wikipedia.org/', | |
'https://www.yahoo.com/', | |
'https://www.reddit.com/', |
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
<?php | |
$array = array( | |
'fruit1' => 'apple', | |
'fruit2' => 'orange', | |
'fruit3' => 'grape', | |
'fruit4' => 'mango', | |
'fruit5' => 'peach'); | |
echo $array['fruit3']; | |
echo "\n"; |
NewerOlder