Skip to content

Instantly share code, notes, and snippets.

View zupo's full-sized avatar

Neyts Zupan zupo

View GitHub Profile
### Keybase proof
I hereby claim:
* I am zupo on github.
* I am zupo (https://keybase.io/zupo) on keybase.
* I have a public key whose fingerprint is E4CA E085 0676 59ED 9941 E22F E1C6 33AA 9CA8 64B9
To claim this, I am signing this object:
@zupo
zupo / amazon_routes.py
Created October 7, 2015 13:15
Compile a list of OpenVPN routes to tunnel traffic for Amazon's IPs
CIDRs = {
'1': '128.0.0.0',
'2': '192.0.0.0',
'3': '224.0.0.0',
'4': '240.0.0.0',
'5': '248.0.0.0',
'6': '252.0.0.0',
'7': '254.0.0.0',
'8': '255.0.0.0',
'9': '255.128.0.0',
@zupo
zupo / ghostpath_servers.py
Created April 10, 2016 18:39
Parse Ghost Path's website to get a list of remotes to insert into openvpn.conf to randomly connect to one
from lxml import html
import requests
COUNTRIES = [
# 'United States',
'Austria',
'Germany',
'Hungary',
'Italy',
'Luxembourg',
@zupo
zupo / alexa_mx.py
Created April 29, 2016 11:13
Count how many top 1 million Alexa sites do not have MX records set
import dns.resolver
from tomorrow import threads
@threads(100)
def mx(id_, domain):
try:
dns.resolver.query(domain, 'MX')
return False
except dns.resolver.NoAnswer:
#!/usr/bin/python
"""How many Alexa top 1 million sites are using self-hosted nameservers?
top.csv is downloaded from Alexa: http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
"""
import gevent.monkey
gevent.monkey.patch_all()
import gevent
from gevent import Greenlet
#!/usr/bin/python
"""How many Alexa top 1 million sites have German (.de) nameservers?
top.csv is downloaded from Alexa: http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
"""
import gevent.monkey
gevent.monkey.patch_all()
import gevent
from gevent import Greenlet
#!/usr/bin/python
"""How many Alexa top 1 million sites have self.hosted nameservers?
top.csv is downloaded from Alexa: http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
"""
import gevent.monkey
gevent.monkey.patch_all()
import gevent
from gevent import Greenlet
@zupo
zupo / home.py
Created December 7, 2016 10:17
example 1
"""
* Put this code into home.py
* Install Pyramid.
* Run ``$ python home.py``.
* Point your browser to http://localhost:8080/
"""
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
@zupo
zupo / home.py
Created December 7, 2016 10:17
Example 2
"""
* Put this code into home.py
* Install Pyramid.
* Run ``$ python home.py``.
* Point your browser to http://localhost:8080/
* Make a POST request with curl: $ curl --data "" http://localhost:8080/
"""
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
"""Showcasing Pyramid's Function Decorators.
Usage:
1. Install Pyramid: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/install.html
2. Put this code into example.py
3. Run with ``$VENV/bin/python example.py``.
You can showcase with your browser or using curl:
$ curl http://localhost:8080/