Skip to content

Instantly share code, notes, and snippets.


Ben Lopatin bennylope

View GitHub Profile
bennylope / blogspot_to_jekyll.rb
Created Oct 5, 2011 — forked from kennym/blogspot_to_jekyll.rb
Migrate your blogger blog posts to jekyll.
View blogspot_to_jekyll.rb
#!/usr/bin/env ruby
# Convert blogger (blogspot) posts to jekyll posts
# Basic Usage
# -----------
# ./blogger_to_jekyll.rb feed_url
# where `feed_url` can have the following format:
bennylope / pagination.rb
Created Oct 18, 2011
Jekyll pagination, pageN pages into /blog/ directory
View pagination.rb
module Jekyll
class Pagination < Generator
# This generator is safe from arbitrary code execution.
safe true
# Generate paginated pages if necessary.
# site - The Site.
bennylope / remotefiles.conf
Created Oct 19, 2011
nginx remote file proxying
View remotefiles.conf
location ~* ^/remote-files/(http[s]*://)(.*?)/(.*) {
# Do not allow people to mess with this location directly
# Only internal redirects are allowed
# nginx has to be able to resolve the remote URLs
# Location-specific logging
#access_log /usr/local/etc/nginx/logs/internal_redirect.access.log main;
bennylope / gist:1894706
Created Feb 23, 2012
Canonical URLs with Jekyll
View gist:1894706
<link rel="canonical" href="{{ page.url | replace:'index.html','' }}" />
from django.test import LiveServerTestCase
from import By
from selenium.webdriver.firefox.webdriver import WebDriver
class MySeleniumTests(LiveServerTestCase):
def setUpClass(cls):
bennylope /
Created May 18, 2012
Quick example of creating a recolorized (one-color) image
# Replacement for ImageFilter.GaussianBlur which always sets the
# blur radius to the default of 2.
# Code from
import ImageFilter
class MyGaussianBlur(ImageFilter.Filter):
name = "GaussianBlur"
bennylope / LICENSE
Last active Aug 3, 2022
Django file that loads environment variables from a .env file per Honcho/Foreman
Copyright the authors of Honcho and/or Ben Lopatin
Licensed for reuse, modification, and distribution under the terms of the MIT license
View gist:3902361
if CONF.has_key?("mounts")
for folder in CONF['mounts']
config.vm.share_folder(folder['name'], folder['virtual'], folder['host'], :nfs => true)
View Vagrantfile.rb
require "yaml"
# Load up our vagrant config files -- vagrantconfig.yaml first
_config = YAML.load(,
"vagrantconfig.yaml"), File::RDONLY).read)
# Local-specific/not-git-managed config -- vagrantconfig_local.yaml
"vagrantconfig_local.yaml"), File::RDONLY).read))
# -*- coding: utf-8 -*-
Models for the "flatpages" project
import time
import socket
from django.db import models