Skip to content

Instantly share code, notes, and snippets.

Maxime Bouroumeau-Fuseau maximebf

Block or report user

Report or block maximebf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maximebf
maximebf / webtail.py
Created Oct 21, 2011
Web tail / tail -f as a webpage using websocket
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
@maximebf
maximebf / fabfile.py
Created Feb 5, 2012
Fabfile to deploy a jekyll site
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)
@maximebf
maximebf / ratp.py
Created Aug 4, 2012
Small Flask app that exposes an API to query French's RATP schedule
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__)
@maximebf
maximebf / gist:3986583
Created Oct 31, 2012
Add dynamic subdomain support to a Flask app
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)
@maximebf
maximebf / gist:3986659
Created Oct 31, 2012
Jinja2 macro to render WTForms fields with Twitter Bootstrap
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 %}:
@maximebf
maximebf / drafts.rb
Created Nov 24, 2012
Draft plugin for jekyll
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
#
@maximebf
maximebf / fabfile.py
Last active Dec 19, 2015
Fabfile to publish jekyll blogs with supervisor and nginx configuration
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 = []
@maximebf
maximebf / config_files.rb
Last active Feb 19, 2016
Plugins, configuration files and fabfile to help you manage a multi-site jekyll setup
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 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 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:
You can’t perform that action at this time.