Skip to content

Instantly share code, notes, and snippets.

View szepnapot's full-sized avatar

Peter Lodri szepnapot

View GitHub Profile
@szepnapot
szepnapot / example.py
Created December 18, 2017 10:47 — forked from thom-nic/example.py
Handler for authenticating HTTPS connections with urllib2. (Python 2.x) Note that the 'ciphers' option in ssl.wrap_socket is python 2.7 only.
import logging, urllib2
import https
client_cert_key = None # file path
client_cert_pem = None #file path
ca_certs = None # file path
handlers = []
handlers.append( HTTPSClientAuthHandler(
@szepnapot
szepnapot / dummy-web-server.py
Created December 15, 2017 14:58 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@szepnapot
szepnapot / .py
Created May 20, 2017 23:07
Write text to image
import sys
import os
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
workdir = os.path.dirname(os.path.abspath(__file__))
text = ' '.join(sys.argv[1:])
print(text)