Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import numpy
import urllib2
import time
import sys
if len(sys.argv) < 2:
sys.stout.write( "Usage: %s http://page/ counter\n" % sys.argv[0])
sys.exit(0)

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

#!/usr/bin/perl -w
#
# Test for OpenSSL CVE-2014-0224
#
# This sends Change Cipher Spec record too early and observes server reply to
# see if it responds with alert (i.e. if it's patched)
#
#flow for a full handshake
#
# Client->Server: ClientHello
@tkhn
tkhn / py-https.py
Created July 4, 2014 14:35
Python HTTPs server
#
# creating the certificate:
# openssl req -x509 -newkey rsa:2048 -keyout localhost.pem -out localhost.pem -days 365 -nodes
#
import BaseHTTPServer, SimpleHTTPServer
import ssl
httpd = BaseHTTPServer.HTTPServer(('localhost', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='localhost.pem', server_side=True)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Salt returner that report error back to sentry
"""
import logging
try:
import crypt
import sys
if len(sys.argv) == 3:
print("%s:%s" % (sys.argv[1], crypt.crypt(sys.argv[2], sys.argv[2])))
else:
print 'python htpasswd.py <user> <pass> >> /path/to/your/htpass_file
#!/bin/sh
#
# gunicorn_sr Startup script for gunicorn for sr
#
# chkconfig: - 86 14
# processname: gunicorn
# pidfile:
# description: Python application server
#
### BEGIN INIT INFO
@tkhn
tkhn / rail.conf
Created September 17, 2014 10:36
rails logrotate config
/home/deploy/APPNAME/current/log/*.log {
daily
missingok
rotate 60
compress
delaycompress
notifempty
copytruncate
}
import os, sys, getpass
import poplib # http://docs.python.org/library/poplib.html
from email.utils import parsedate_tz
import calendar
import datetime
# The main parameter
last_wanted = datetime.datetime(2009, 10, 5)
print last_wanted
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Adrien Pujol - http://www.crashdump.fr/"
__copyright__ = "Copyright 2013, Adrien Pujol"
__license__ = "Mozilla Public License"
__version__ = "0.3"
__email__ = "[email protected]"
__status__ = "Development"
__doc__ = "Check a TLS certificate validity."