Skip to content

Instantly share code, notes, and snippets.

Avatar

Giles Thomas gpjt

View GitHub Profile
@gpjt
gpjt / letsencrypt.py
Last active Oct 25, 2020
Sample acme code to get a certificate from Let's Encrypt
View letsencrypt.py
# 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.
#
View foo.py
import subprocess
print(subprocess.check_output(["pip", "install", "--user", "aafigure"]))
View reload_server.py
!#/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: ')
View threadify_test.py
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()
@gpjt
gpjt / load_tuples.py
Last active Dec 15, 2015
Loading CSVs as tuples
View load_tuples.py
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 Dec 10, 2015
Test gist
View file.py
print "Hello, gistworld!"
@gpjt
gpjt / nginx-uwsgi-upgrade-post.md
Created Sep 5, 2012 — forked from hjwp/nginx-uwsgi-upgrade-post.md
Draft blog post on the switch from apache to nginx/uwsgi
View nginx-uwsgi-upgrade-post.md

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:

You can’t perform that action at this time.