Tagged: shell RSS Toggle Comment Threads | Keyboard Shortcuts

  • fmeyer 11:41 pm on May 29, 2009 Permalink | Reply
    Tags: measurement, , shell   

    mtimeit module provides a simple way to time small bits of Python code. It has both command line as well as callable interfaces. It avoids a number of common traps for measuring execution times. See also Tim Peters’ introduction to the “Algorithms” chapter in the Python Cookbook, published by O’Reilly.

    the command line example:

    python -mtimeit -s"from math import sqrt; x = 123" "x**.5"
    

    the module example:

    >>> import timeit
    >>> s = """\
    ... try:
    ...     str.__nonzero__
    ... except AttributeError:
    ...     pass
    ... """
    >>> t = timeit.Timer(stmt=s)
    >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
    17.09 usec/pass
    >>> s = """\
    ... if hasattr(str, '__nonzero__'): pass
    ... """
    >>> t = timeit.Timer(stmt=s)
    >>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
    4.85 usec/pass
    

     
  • fmeyer 7:39 pm on May 28, 2009 Permalink | Reply
    Tags: , console, shell   

    Enabling grep coloring, put it under .bashrc or .bash_profile on mac

    alias grep='GREP_COLOR="1;33;40" LANG=C grep --color=auto'
    
     
  • fmeyer 7:27 pm on May 28, 2009 Permalink | Reply
    Tags: cryptography, gpg, shell   

    Simple and fast gpg crypt

    fmeyer@fnandomac ~/projects/canivete $ gpg -c gpg.txt
    
     
  • fmeyer 7:20 pm on May 28, 2009 Permalink | Reply
    Tags: rsync, shell   

    I always forget the amazing rsync between a remote and my local disk

    rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/
    

     
  • fmeyer 7:15 pm on May 28, 2009 Permalink | Reply
    Tags: git, shell   

    Whenever you should blame someone on your team … use this tittle commit war tool

    git shortlog -s -n --all
    

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.