Wednesday, July 17, 2013

Bizplan = entrepreneur handcuff for investors

Business plan is an amazing tool to help entrepreneurs clarifying their vision but its used as a risk tool by some investors to reduce their risk, basically its handcuff for entrepreneurs. Many investors (no value investor/only money investors) will use it to reduce their risk. Less values your investors will bring on the table the more they will use your own business plan to hang you and the worst valuation they will give you. Basically, the less value they bring on the table, the more they will try to screw you. Learn to negotiate, stay in a strong position, its like war.

5 Lessons Entrepreneurs Can Take From D-Day
http://www.linkedin.com/today/post/article/20130607022027-37142409-5-lessons-entrepreneurs-can-take-from-d-day?_mSplash=1

Monday, July 15, 2013

greping zip/bz2 files is annoying: -H option doesn't work

grep is a quite useful command line but some options don't leave well with zip files....like:
-H, --with-filename       print the filename for each match 

bzgrep nore zgrep solve the problem, it is making the same effect as:
zcat *.bz2 | grep -H "something"

it generate this
 (standard input):

not:
filename:

So here is my zgrep.py (example: ls *.gz | zgrep.py "a <.*> (.*)")
#!/usr/bin/env python
''' allow grep -H option of bzip & zip files '''

import sys
import gzip
import bz2
import re
 
exp = sys.argv[1]
expExtractor = re.compile(exp)

for filename in sys.stdin:
    filename = filename.strip()
    if filename.endswith('.gz'):
        freader = gzip.open(filename,'r')
    elif filename.endswith('.bz2'):
        freader = bz2.BZ2File(filename)
    else:
        freader = open(filename, 'r')
    for i, line in enumerate(freader):
        line = line.strip()
        if expExtractor.search(line):
            print "%s:%i <%s>" %(filename, i, line)