Skip to content

Instantly share code, notes, and snippets.

View uolter's full-sized avatar

Walter Traspadini uolter

View GitHub Profile
@uolter
uolter / gist:4258624
Created December 11, 2012 13:39
find and exclude svn directory
find . -type f | grep -v '\.svn' | xargs grep "img/add.png"
@uolter
uolter / vhost_dotcom2013
Created December 4, 2012 14:07
Rewrite rule based on cookie and matching URI for preview landing page
RewriteEngine on
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 5
# Check whether the cookie role exists and whether the url does not contain PRV.shtml
# if so it executes the rewrite rule
RewriteCond %{HTTP_COOKIE} role=(.*)
RewriteCond %{REQUEST_URI} !^.*_PRV.*
RewriteRule /art/(.*).shtml /art/$1_PRV.shtml [NC,QSA]
@uolter
uolter / jsonp.py
Created November 26, 2012 09:16
jsonp decorator for python
'''
Created on Nov 23, 2012
@author: uolter
'''
from functools import wraps
from flask import request, current_app
@uolter
uolter / flaskapp_init.py
Last active October 12, 2015 15:18
flask application basic setup (python flaskapp_init.py -a <myapp> )
#!/usr/local/bin/python
from optparse import OptionParser
import os
PATH_SEPARATOR = os.sep
html_layout = "<!DOCTYPE html>\n" \
"<html>\n" \
@uolter
uolter / init_flaskapp.sh
Created November 9, 2012 13:53
flask project dir structure
#!/bin/bash
APP_NAME="${1}"
if [ "$APP_NAME" = "" ]; then
echo "you must provide an application name!! "
echo "usage: <this script> <app name>"
exit
fi