Skip navigation

teranex weblog

top menu

sync

Using your Bash and Vim config on multiple computers

Not long after I switched to Linux I started modifying my .bashrc file. In a .bashrc file you can set options for Bash, add aliases, configure your Bash prompt etc. When I decided to start using Vim as my main editor a few weeks ago, I also started tinkering with the .vimrc file. The .vimrc file is, similar to the .bashrc file, the place-to-be to configure Vim.

Obviously I wanted to share all these config-files between my work machine and my personal computer. That is why I set up a Git repository on my Dreamhost webspace. With most of your important config-files in a Git repository you can easily share your config between multiple computers and you get a history of your modifications as a free bonus.

Because I want to keep it clear which files are in the Git repo and which files are not, I just created a directory in my homedirectory called 'scripts' (so at ~/scripts/). Everything in that directory is in Git, everything outside the directory is not. But because the Bash and Vim RC-files are outside the ~/scripts/ directory you will have to do some additional step to make those programs use the RC-files from the scripts-directory. For Bash, you can simply source your own Bash-file from your .bashrc by adding the following lines to the end:

1
2
3
if [ -f ~/scripts/bashrc/bootstrap ]; then
        source ~/scripts/bashrc/bootstrap
fi

For Vim, I simply create softlinks to .vimrc and .vim/ (if .vimrc and/or .vim/ already exist you will have to remove them first). On the commandline type:

1
2
3
4
56
7
8
# make sure you are in your home directory
$ cd
# remove the .vimrc and .vim/ if it exists (this will delete everything, obviously!!)
$ rm .vimrc
$ rm -rf .vim/# make the softlinks
$ ln -s scripts/vimrc .vimrc
$ ln -s scripts/vim/ .vim

Settings specific to one computer

Because I use every computer for a different task, my preferred configuration sometimes slightly differs for each machine. That's why I came up with a small addition for both Bash and Vim. In Both cases the default configuration file sources an additional configuration file, which is specific to the machine. To automate this, I use the hostname of the machine. So for Bash I have the following lines at the end of my bootstrap script:

1
2
3
if [ -f ~/scripts/bashrc/$(hostname -s) ]; then
        source ~/scripts/bashrc/$(hostname -s)
fi

When this code is run on my personal pc, it will look to see if ~/scripts/bashrc/andoria exists, and if so execute it. On my work-laptop it will source the file ~/scripts/bashrc/delta-vega. When I use the scripts on another machine, no file specific to that host would be found, so nothing would be executed. But adding host-specific config for that machine would be as simple as just creating an additional file with the hostname as the filename.

For Vim I use a similar approach. At the end of my .vimrc I have the following code, which checks for a host-specific vimrc-addition and sources it:

1
2
3
4
let hostfile='/home/jeroen/scripts/vim/vimrc-' . hostname()
if filereadable(hostfile)
    exe 'source ' . hostfile
endif

So again, I have the vimrc-andoria file for my personal machine, and vimrc-delta-vega for my work-laptop. One small note: I couldn't get this working without the full path (/home/jeroen/), instead of ~/. But that is probably just something I did wrong. After all, I still need to learn the basics to Vim-scripting ;).

The Floccinaucinihilipilification Homepage - .is audio player file ...

This is a brief description of the options that are supported by banshee in the .is_audio_player file. The .is_audio_player file is used by banshee to determine how to interact with media players that connect using USB Mass Storage.

http://www.floccinaucinihilipilification.net/wiki/index.php/.is_audio_player_file_format

MyPhoneExplorer and Thunderbird under Linux

This guide will tell you how to install MyPhoneExplorer on Ubuntu and how to sync your phone with Thunderbird and Lightning.

http://www.fjsoft.at/forum/viewtopic.php?t=5835

Bestanden synchroniseren met Unison

Nu ik mijn laptop weer aan de praat heb gekregen en zowel m'n desktop PC als m'n laptop Linux draaien heb ik de manier waarop ik deze synchroniseer nog eens herbeken en aangepast. Toen mijn beide PC's windows draaiden maakte ik gebruik van Subversion, om de bestanden op de Desktop en Laptop te synchroniseren. Dit werkte vrijwel perfect om op beide PC's alle betanden te hebben en had als extra voordelen dat er een geschiedenis van wijzigingen werd bijgehouden (zo werkt SVN nu eenmaal) en, omdat de repository bij Dreamhost stond, dat ik ineens een off-site backup had. Er waren ook wel een paar nadelen aan verbonden. Om te synchroniseren moet je op beide PC's een svn commit doen en een svn update, soms meerdere keren als er op de beide pc's wijzigingen waren. Bovendien duurde het even omdat de wijzigingen moesten geuploaded worden naar Dreamhost en gebruikte ik het niet voor echt persoonlijke bestanden (bankafschriften etc) omdat de gegevens bij Dreamhost niet geëncrypteerd waren.

Nu gebruik ik twee aparte tooltjes voor enerzijds de synchronisatie tussen de twee pc's en anderzijds de off-site backup. Voor de backup gebruik ik Duplicity, waar ik niet verder op in ga. Voor de synchronisatie gebruik ik Unison. Unison werkt zowel onder Linux als onder Windows. Onder Ubuntu kan je het installeren (met GUI) door in de terminal sudo apt-get install unison-gtk uit te voeren.

Als je de GUI van Unison voor de eerste keer start wordt je gevraagd welke twee mappen je wil synchroniseren. Deze manier om Unison in te stellen is echter nogal weinig flexibel. Zelf bewerk ik altijd rechtstreeks de .prf bestanden van Unison. Deze zijn te vinden in /home/your-username/.unison/. Deze bestanden kan je in een text-editor zoals Gedit openen en bijmaken, op de pc vanwaaruit je de synchronisatie wil uitvoeren. In mijn geval start ik de synchronisatie altijd vanop de laptop dus het prf bestand staat op de laptop. Een voorbeeld van zo'n bestand ziet er als volgt uit:

1
2
3
4
56
7
8
9
1011
12
# Unison preferences file
root = /media/cryptdata
root = ssh://192.168.1.112//media/DATA/
perms = 0
 ignore = Path data
ignore = Path _ARCHIVE
ignore = Path music
 
ignore = Path lost+foundignore = Path .Trash-*
ignore = Path dev/repos

Zoals je kan zien wordt de locatie /media/cryptdata (op de laptop) gesynchroniseerd met de locatie ssh://192.168.1.112//media/DATA/. Dit is een NTFS partitie die gemount is op /media/DATA op mijn desktop PC, die via OpenSSH bereikbaar is op ons lokale netwerk. Omdat de bestandsrechten op de NTFS partitie anders worden ingesteld dan op de laptop (Ext3) gebruik ik de optie perms = 0 zodat bestandspermissies worden genegeerd. Met de ignore-optie kan je bestanden en paden laten negeren, zoals je in mijn configuratie kan zien. Er zijn nog tal van andere opties die in de manual kan terugvinden.

duplicity: Main

Duplicity backs directories by producing encrypted tar-format volumes and uploading them to a remote or local file server. Because duplicity uses librsync, the incremental archives are space efficient and only record the parts of files that have changed since the last backup. Because duplicity uses GnuPG to encrypt and/or sign these archives, they will be safe from spying and/or modification by the server.

http://duplicity.nongnu.org/

Backups on non-trusted FTP servers - heise Security UK

Anyone storing data on an unfamiliar FTP server needs to encrypt and sign it to ensure reliable protection against prying eyes and external manipulation. duplicity is just the tool for this, and the ftplicity script from c't magazine makes working with it child's play.

http://www.heise-online.co.uk/security/Backups-on-non-trusted-FTP-servers--/features/79882

Manent – Trac

Manent is an algorithmically strong backup and archival program

http://trac.manent-backup.com/

Home Page - Rsyncrypto

Rsyncrypto is like rsync but encrypted

http://rsyncrypto.lingnu.com/index.php/Home_Page

Allway Sync: Free File Synchronization, Backup, Data Replication, PC Sync Software, Freeware, File Sync, Data Synchronization Software

Allway Sync is free file and folder synchronization software for Windows.

http://allwaysync.com/index.html

Remember the Milk Provider :: Thunderbird Add-ons

Allows access to Remember The Milk task lists through Thunderbird and Lightning.

https://addons.mozilla.org/en-US/thunderbird/addon/7125