Skip to content

Instantly share code, notes, and snippets.

View phaer's full-sized avatar
💭

Paul Haerle phaer

💭
View GitHub Profile
#!/bin/zsh -f
set -e
HOSTNAME=$1
PASSWORD=toor
VMNAME=$HOSTNAME
FILE="$VMNAME.img"
SIZE=2G
ARCH=amd64
@phaer
phaer / private.py
Last active December 23, 2015 07:28
Mediagoblin m*e*ddleware to keep your instance private.
from mediagoblin.meddleware import BaseMeddleware
from mediagoblin.tools.response import redirect
class PrivateMeddleware(BaseMeddleware):
"""Private Meddleware
Redirects requests by unauthenticated clients to the login form.
"""
public_views = [
@phaer
phaer / raw_tag.rb
Created June 11, 2011 19:11
Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}
module Jekyll
class RawTag < Liquid::Block
def parse(tokens)
@nodelist ||= []
@nodelist.clear
while token = tokens.shift
if token =~ FullToken
if block_delimiter == $1
end_tag
@phaer
phaer / coffeescript_converter.rb
Created May 6, 2011 22:39
A trivial CoffeeScript.org -> Javascript plugin for jekyll ( https://github.com/mojombo/jekyll ). Put this file in '_plugins/' and write a YAML header to your .coffee files (i.e. "---\n---\n")
module Jekyll
require 'coffee-script'
class CoffeeScriptConverter < Converter
safe true
priority :normal
def matches(ext)
ext =~ /coffee/i
end
@phaer
phaer / ostatus_tag.rb
Created April 10, 2011 16:06
Simple Jekyll tag which displays the notices in a given status.net/ostatus feed.
require 'date'
require 'ostatus'
module Jekyll
class RenderOStatus < Liquid::Tag
def render(context)
site = context.registers[:site]
feed = OStatus::Feed.from_url(site.config['ostatus_feed'])
result = "<h2>#{feed.author.name}'s microblog</h2>"