This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APP_NAME="${1}" | |
if [ "$APP_NAME" = "" ]; then | |
echo "you must provide an application name!! " | |
echo "usage: <this script> <app name>" | |
exit | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
from optparse import OptionParser | |
import os | |
PATH_SEPARATOR = os.sep | |
html_layout = "<!DOCTYPE html>\n" \ | |
"<html>\n" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Nov 23, 2012 | |
@author: uolter | |
''' | |
from functools import wraps | |
from flask import request, current_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f | grep -v '\.svn' | xargs grep "img/add.png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svn st | grep ? | awk '{print $2}' | xargs svn add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
import heapq | |
class Node(object): | |
def __init__(self, pairs, frequency): | |
self.pairs = pairs | |
self.frequency = frequency | |
def __repr__(self): | |
return repr(self.pairs) + ", " + repr(self.frequency) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.optimize import fmin_cg | |
def cost(p, Y, R, alpha): | |
""" | |
Calculates collaborative filtering cost function. | |
Arguments | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# save this script in your bin directory source it. | |
# source cdb.sh | |
# (it would be nice to do that in your bash profile as well.) | |
# Then you can run the cdb function in every terminal and bookmark any path you like.s | |
function show_bookmark { | |
for f in `ls ~/.cd_bookmarks/` | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import unittest | |
def count(text): | |
# if the text is None or empty do nothing | |
if text: | |
text = text.replace(' ', '') | |
else: | |
return None |
OlderNewer