Lazy dev exp+

tools & tips


agenda

  • Linux
    - bash: .bashrc, CLI hotkey, prompt
    - virtualenv: shortcut, cache
    - byobu: terminal window manager

  • Python
    - Django debug case
    - one-liners

  • Web
    - Firefox
    - Chrome

  • Others: emacs?

Linux::bash

  • .bashrc
    - history.  HISTFILESIZE, HISTSIZE, histappend...
    - nice prompt for git/hg
       https://github.com/milkbikis/powerline-bash
       function _update_ps1() { export PS1="$(~/Scripts/powerline-bash.py --cwd-only $?)" }
    - export PROMPT_COMMAND="history -a; _update_ps1"
    - use CDPATH, can cd subdir in anywhere.
       export  CDPATH='.:~:~/project'

  • CLI hotkey
    - emacs mode. seach, move to start/end, <alt> + .
    - vi mode. set -o vi
    - work on python shell, mysql shell, mongo shell, etc...

Byobu

  • window manager, backend is tmux/screen
  • teamocil + tmux  Link: preview, repo


virtualenv

  • check site packages
    - yolk   or   'pip freeze --local'
  • virtualenvwrapper
    - dynamic load
    - tips and tricks
    - alias v='workon'
       alias v.mk='mkvirtualenv --distribute'
    - error. import random... execute mkvirtualenv name
  • cache
    export PIP_DOWNLOAD_CACHE=$HOME/.pip/DIR
    sudo  visudo, add:
    Defaults        env_keep += "PIP_DOWNLOAD_CACHE"

Other

  • script  ps_mem.py    download @github
  • hibernate
  • fab
  • select clip access
  • one more script?

wanted

  • window capture. wmctrl?
  • 番茄钟 / workrave

PYTHON

  • Django debug case
    ImportError: No module named urls
    strace

  • oneliners
    $ echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool | pygmentize -l json


     $ python -m smtpd -n -c DebuggingServer localhost:25

     $ python -m SimpleHTTPServer 8080


Don't use 

os.chdir()

 in Django

 with uwsgi


! ! !

for loop in pyhon

Counting, without counting, in Python: Brandon Rhodes

# Creates one million integers

for i in range(1000000):
    print

# Creates them one at a time

for i in xrange(1000000):
    print


      简单的测试 (1 ms = 1000 us = 1000,000 ns) wiki

$ python -m timeit \
>  -s 'from itertools import repeat' \
>  'for x in repeat(None, 1000000): pass'

100 loops, best of 3: 16.8 msec per loop

run it

$ python -m timeit -s 'from itertools import repeat'  'for x in range(1000000): pass'       
10 loops, best of 3: 52.8 msec per loop

$ python -m timeit -s 'from itertools import repeat'  'for x in xrange(1000000): pass'      
100 loops, best of 3: 15 msec per loop

$ python -m timeit -s 'from itertools import repeat'  'for x in repeat(None, 1000000): pass'
100 loops, best of 3: 11.1 msec per loop

$ python -m timeit -s 'for x in xrange(1000000): pass'
100000000 loops, best of 3: 0.0111 usec per loop


Web

  • Firefox addon
    server switcher
    scrapbook
    lastpass
    xml and json view

  • Chrome
    User Agent and frame width
    middle click in new tab

  • wanted
    one key search

other::bitcoin

mining


专业矿工



notes

  • teamviewer: remote control
  • mining pool. p2pool
  • blockchain
  • key

FAq

  • 51% attack
  • 庞氏骗局?
  • GPU vs CPU

other::emacs?

learning curves

feature

  • minor mode
  • buffer
  • keyboard flow
  • remote edit
  • macros 
    Emacs(源自Editor MACroS,宏编辑器)
  • <alt+x> execute function
  • extension (package)
  • customize?
    scp case
    stardict 
    integrate

Plugin

  • desktop
  • magit.el
  • ido
  • flymake
  • Org-mode (with MobileOrg)
  • info and help
  • pymacs + rope
  • yasnippet
  • sqlplus.el

wanted

  • python spec. align line
  • better project
  • navigator
  • python shell
  • window switch

resourcEs

Copy of Lazy exps of Linux/Python Developer

By Liu Bo

Copy of Lazy exps of Linux/Python Developer

Just for archive

  • 1,911