Skip to content

Instantly share code, notes, and snippets.

@bennylope
bennylope / blogspot_to_jekyll.rb
Created October 5, 2011 15:23 — forked from kennym/blogspot_to_jekyll.rb
Migrate your blogger blog posts to jekyll.
#!/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
bennylope / pagination.rb
Created October 18, 2011 00:33
Jekyll pagination, pageN pages into /blog/ directory
module Jekyll
class Pagination < Generator
# This generator is safe from arbitrary code execution.
safe true
# Generate paginated pages if necessary.
#
# site - The Site.
#
@bennylope
bennylope / remotefiles.conf
Created October 19, 2011 01:30
nginx remote file proxying
location ~* ^/remote-files/(http[s]*://)(.*?)/(.*) {
# Do not allow people to mess with this location directly
# Only internal redirects are allowed
internal;
# nginx has to be able to resolve the remote URLs
resolver 8.8.8.8;
# Location-specific logging
#access_log /usr/local/etc/nginx/logs/internal_redirect.access.log main;
@bennylope
bennylope / gist:1894706
Created February 23, 2012 19:50
Canonical URLs with Jekyll
<link rel="canonical" href="http://yourdomain.com{{ page.url | replace:'index.html','' }}" />
from django.test import LiveServerTestCase
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.webdriver import WebDriver
class MySeleniumTests(LiveServerTestCase):
@classmethod
def setUpClass(cls):
@bennylope
bennylope / gaussian_replacement.py
Created May 18, 2012 20:58
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 http://aaronfay.ca/content/post/python-pil-and-gaussian-blur/
import ImageFilter
class MyGaussianBlur(ImageFilter.Filter):
name = "GaussianBlur"
@bennylope
bennylope / LICENSE
Last active August 17, 2023 10:44
Django manage.py 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
if CONF.has_key?("mounts")
for folder in CONF['mounts']
config.vm.share_folder(folder['name'], folder['virtual'], folder['host'], :nfs => true)
end
end
require "yaml"
# Load up our vagrant config files -- vagrantconfig.yaml first
_config = YAML.load(File.open(File.join(File.dirname(__FILE__),
"vagrantconfig.yaml"), File::RDONLY).read)
# Local-specific/not-git-managed config -- vagrantconfig_local.yaml
begin
_config.merge!(YAML.load(File.open(File.join(File.dirname(__FILE__),
"vagrantconfig_local.yaml"), File::RDONLY).read))
### MODEL
# -*- coding: utf-8 -*-
"""
Models for the "flatpages" project
"""
import time
import socket
from django.db import models