Skip to content

Instantly share code, notes, and snippets.

@gpjt
gpjt / letsencrypt.py
Last active February 29, 2024 03:50
Sample acme code to get a certificate from Let's Encrypt
# There's a lack of sample code for acme/Let's Encrypt out there, and
# this is an attempt to at least slightly remedy that. It's the result
# of my first day's hacking on this stuff, so almost certainly contains
# errors and oversights.
#
# It's not designed to be specifically useful if what you want is
# just a cert -- certbot or dehydrated are better for that. It is sample
# code for people who are building automated systems to deal with large
# numbers of Let's Encrypt certificates to play with.
#
@gpjt
gpjt / foo.py
Last active August 24, 2017 15:21
import subprocess
print(subprocess.check_output(["pip", "install", "--user", "aafigure"]))
!#/usr/bin/python
import mechanize
import getpass
import time
import os
def reload(username=None, password=None, domain=None):
if username is None:
username = raw_input('Username: ')
@gpjt
gpjt / load_tuples.py
Last active December 15, 2015 09:19
Loading CSVs as tuples
def load_file(filename):
fp = open(filename, 'Ur')
data_list = []
for line in fp:
data_list.append(tuple(line.strip().split(',')))
fp.close()
return data_list
def save_file(filename, data_list):
fp = open(filename, 'w')
@gpjt
gpjt / file.py
Last active December 10, 2015 23:29
Test gist
print "Hello, gistworld!"
@gpjt
gpjt / nginx-uwsgi-upgrade-post.md
Created September 5, 2012 14:48 — forked from hjwp/nginx-uwsgi-upgrade-post.md
Draft blog post on the switch from apache to nginx/uwsgi

Beloved users, and whomever else may find it of interest,

We recently made the switch from nginx to uwsgi. Well, I say recently, as far as I can tell from the commit logs we started work on it around July 10th, so that's fully six weeks ago. We just deployed it this week, and after a bumpy first few days it seems to be settling in well. We thought we'd share why we switched, and how it's going.

tl;dr:

import subprocess
subprocess.check_call("git clone https://github.com/drandreaskrueger/threadify", shell=True)
import sys
sys.path.append(".")
import threadify.threadify_examples
threadify.threadify_examples.testGetPagesAndAnalyze()