Recent Updates RSS Hide threads | Keyboard Shortcuts

  • fmeyer 3:25 pm on May 31, 2009 Permalink | Reply
    Tags: , mac, osx

    Mac Osx pbcopy and pbpaste, provide copying and pasting to the pasteboard (the Clipboard) from command line, it does accept data from the standard input, so, you can find amazing uses for it

    
    find . -name *txt | pbcopy
    
     
  • fmeyer 11:41 pm on May 29, 2009 Permalink | Reply
    Tags: measurement, ,

    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 12:26 am on May 29, 2009 Permalink | Reply
    Tags: arduido, circuit, homemade

    Home made circuit boards

    That’s amazing and easy =)

     
  • fmeyer 8:52 pm on May 28, 2009 Permalink | Reply

    Decoding as dictionary an ajax form uri with magic and lambda

    
    # Don't thouch this shit
    def urldecode(url):
        x = {}
        map(lambda dt: x.update(dt), map(lambda word: {word[0] : \
        word[1]}, map(lambda param: param.split('='),re.compile( \
        '%([0-9a-hA-H][0-9a-hA-H])',re.M).sub(lambda m: chr(int( \
        m.group(1),16)),url.replace('+', ' ')).decode("utf-8").split('&'))))
        return x
    

    as you can see, my comment denotes it as a badsmellstuff

     
  • fmeyer 7:41 pm on May 28, 2009 Permalink | Reply
    Tags: autocomplete, , ssh

    Previously accessed ssh servers bash completion put it under .bashrc or .bash_profile [mac]

    
    SSH_COMPLETE=( $(cat ~/.ssh/known_hosts | \
                     cut -f 1 -d ' ' | \
                     sed -e s/,.*//g | \
                     uniq ) )
    complete -o default -W '${SSH_COMPLETE[*]}' ssh
    
     
  • fmeyer 7:39 pm on May 28, 2009 Permalink | Reply
    Tags: , console,

    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:32 pm on May 28, 2009 Permalink | Reply
    Tags: emacs, lisp, textedit

    Sums a column of numbers starting at point

    
    (defun sum-column()
      "Sums a column of numbers starting at point"
      (interactive)
      (save-excursion
        (if (and (not (= (current-column) 0))
    	     (re-search-backward "[ \t]" 0 t ))
    	(forward-char))
        (let ((retn 0)
    	  (old-column (current-column))
    	  (old-next-line-add-newlines))
          (setq next-line-add-newlines nil)
          (while (not
    	      (looking-at "^[ \t]*$"))
    	(move-to-column old-column t)
    	(if (and (looking-at "-?[0123456789]+")
    		 (eq (current-column) old-column))
                (setq retn (+ retn (string-to-number (current-word)))))
    	(next-line)
    	(beginning-of-line))
          (next-line)
          (next-line)
          (move-end-of-line 0)
          (insert (make-string (- old-column (current-column)) 32))
          (insert (number-to-string retn))
          (setq next-line-add-newlines old-next-line-add-newlines)
          retn)))
    
     
  • fmeyer 7:27 pm on May 28, 2009 Permalink | Reply
    Tags: cryptography, gpg,

    Simple and fast gpg crypt

    
    fmeyer@fnandomac ~/projects/canivete $ gpg -c gpg.txt
    
     
  • fmeyer 7:22 pm on May 28, 2009 Permalink | Reply
    Tags: developer, fun, ux, war

    Just happened on my team:
    Developer : I have installed the full adobe software package on my Macbook, so I’m a better designer than you.
    Designer: I have mysql and python on my laptop, so I’m a developer as you.

     
  • fmeyer 7:20 pm on May 28, 2009 Permalink | Reply
    Tags: rsync,

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

    
    rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/
    
     
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
esc
cancel