View gist:988f45bbda2942cb12c5
### Keybase proof
I hereby claim:
* I am maximebf on github.
* I am maximebf (https://keybase.io/maximebf) on keybase.
* I have a public key whose fingerprint is 6406 AD6C BB97 BE07 6B87 C7B3 682E 2EB1 7598 80E1
To claim this, I am signing this object:
View mgitstatus
#!/bin/bash
# Display the status of all git directories in the current directory
show() {
cd $1
branch=`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\\\\\1/`
if [ -n "`git status 2> /dev/null | grep 'nothing to commit'`" ]; then
status="\e[32mok\e[0m"
else
status="\e[31mmodified\e[0m"
View config_files.rb
module Jekyll
class Site
def read
self.read_config
self.read_layouts
self.read_directories
end
def read_config(dir='')
View fabfile.py
from fabric.api import task, env, execute, local
env.build_path = '/tmp/jekyll'
env.publish_path = '~/sites'
@task
def serve(future='yes', drafts='yes', port=4000):
flags = []
View drafts.rb
# Search for posts in _drafts folder
#
# Add "drafts: true" in your config file to
# activate the plugin
#
# Filenames should not have a date
# eg: _drafts/my-future-posts.md
#
# Draft posts will have a post.draft property
#
View gist:3986659
{% macro form_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="control-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
View gist:3986583
def add_subdomain_to_global(endpoint, values):
g.subdomain = values.pop('subdomain', None)
def add_subdomain_to_url_params(endpoint, values):
if not 'subdomain' in values:
values['subdomain'] = g.subdomain
def add_subdomain_support(app):
app.url_value_preprocessor(add_subdomain_to_global)
app.url_defaults(add_subdomain_to_url_params)
View ratp.py
#!/usr/bin/env python
# coding: utf-8
from flask import Flask, request, jsonify
import urllib2
from BeautifulSoup import BeautifulSoup
app = Flask(__name__)
View fabfile.py
from fabric.api import task, run, env, execute, local, put, lcd
env.site_path = '/tmp/jekyll-site'
env.tar_filename = env.site_path + '.tar.bz2'
env.remote_site_path = '~/public_html'
@task
def build():
local("jekyll %s" % env.site_path)
View webtail.py
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver