Share
Embed
Explicit developer laptop automation
Presentation at PyGrunn in May 2012
Reinout van Rees
May 11, 2012
Transcript
21 slides
-
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. -
What to collect? •Python tools •Handy shell scripts •Your custom
tasks (so you finally make them) -
~/tools/bin •https://github.com/ reinout/tools •Shell+py scripts •Pip requirements file •Local development
(zest.releaser, etc.) •... look on github -
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) -
My ~/Dotfiles •New laptop? •Second home machine? •Your kid has
a screwdriver? •All those nifty tricks... -
.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 -
.profile # Handy aliases for going up in a directory.
alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." -
.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" -
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 -
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) -
.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 -
Backups •Automate this, too •Mail: copy on own server, imap
on gmail •Git/hg/svn •Timemachine •Ubuntu one •Backup own server: backupninja -
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 -
/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 -
Questions? •dotfiles •checkoutmanager •collect & automate explicitly •backup & backupninja
•http://reinout.vanrees.org/