Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Explicit developer laptop automation

Explicit developer laptop automation

Presentation at PyGrunn in May 2012

Reinout van Rees

May 11, 2012
Tweet

More Decks by Reinout van Rees

Other Decks in Technology

Transcript

  1. Explicit is better than implicit •Don’t just fool around. •Collect

    everything. •“The cobbler’s children go barefoot.” •If it isn’t version controlled, it doesn’t exist. Or it isn’t explicit enough.
  2. Dotfiles •On pypi. “pip install”(=> ~/tools/bin for me) •~/Dotfiles with

    files and directories •Symlinked into the root as dotfiles •Dotfiles command itself only manages it: great single-purpose script •Separate: ~/.emacs.d (=> starter kit)
  3. My ~/Dotfiles •New laptop? •Second home machine? •Your kid has

    a screwdriver? •All those nifty tricks...
  4. .inputrc # Ignore case for tab completion. set completion-ignore-case on

    # No need to press tab twice set show-all-if-ambiguous on # Type the start of a command ("svn" # or so) and press up/down to cycle # through previous versions of that # command. "\e[A": history-search-backward "\e[B": history-search-forward
  5. .profile # Handy aliases for going up in a directory.

    alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.."
  6. .profile # No accidental shell closing with ctrl-d. export IGNOREEOF=1

    # Two-line prompt export PS1="\u@\h:\w\n$ " # Exclude certain things from the # command history. export HISTIGNORE="&:l:vdir:[bf]g:exit"
  7. Version control •Lots on github and bitbucket •But... dotfiles? Passwords?

    FTP accounts? •=> Private repository on own linux box •ssh://vanrees.org/~/git/Dotfiles •ssh://vanrees.org/hg/preken
  8. Checkoutmanager •Loads of git, bzr, hg, svn checkouts •31 git,

    22 svn, 9 hg •No way I’m going to do “git pull” on every one of them in the morning! •=> checkoutmanager •commands: up, st, co, out •On pypi (and source on bitbucket)
  9. .checkoutmanager.cfg [git] vcs = git basedir = ~/git/ checkouts =

    [email protected]:camptocamp/collective.eggproxy.git [email protected]:reinout/django.git [email protected]:reinout/gitignore.git [email protected]:reinout/pep8.git [email protected]:reinout/reinout.vanrees.org.git [email protected]:reinout/serverinfo.git [email protected]:zestsoftware/zest.releaser.git [email protected]:rvanlaar/djangorecipe.git ssh://vanrees.org/~/git/websitecontent ssh://vanrees.org/~/git/samplecodediffer
  10. Backups •Automate this, too •Mail: copy on own server, imap

    on gmail •Git/hg/svn •Timemachine •Ubuntu one •Backup own server: backupninja
  11. vanrees.org backupninja example setup root@rees:/etc/backup.d# ls -l total 24 -rw-------

    1 root root 677 2011-12-28 22:05 10-homes.rdiff -rw------- 1 root root 259 2008-10-30 21:54 11-mail.rdiff -rw------- 1 root root 365 2009-11-30 22:02 12-zope.rdiff -rw------- 1 root root 236 2008-10-30 22:01 13-systemfiles.rdiff -rw------- 1 root root 526 2008-10-29 22:39 30-repos.svn -rw------- 1 root root 228 2008-10-29 20:53 90-bytemarkrsync.sh
  12. /etc/backup.d/11-mail.rdiff [source] label = mail type = local keep =

    30 # The imap mail is stored in ~/mail include = /home/*/mail # but Maurits claims it is in Mail include = /home/*/Mail # The inbox is in /var/mail include = /var/mail [dest] type = local directory = /var/backups