笔记

02 Jul 2013

Javascript:

Math下面的常量和方法都可以直接用。

Math.PI, Math.sqrt(2)

Piping with SSH:

Tarred file transfer

$ tar zcf - stuff | ssh user@server 'cd xxx;tar zxf -'
$ ssh user@server 'tar zcf - stuff' | tar zxf -

Offsite backups

$ tar zcf - stuff | ssh user@server 'cat - > stuff.tar.gz'

Hard drive backup/mirror

$ dd if=/dev/sda | ssh user@server 'dd of=sda.img'
$ ssh user@server 'dd if=sda.img' | dd of=/dev/sda

Run a local script remotely

$ ssh user@server 'bash -s' < script.sh

comments powered by Disqus