Feeds:
Posts
Comments

Posts Tagged ‘dropbox’

A good script.

A good script.

I just finished setting up something neat for my MacBook Pro: a script that takes the IP address of the laptop on wake and writes it to a file that is then synced online via Dropbox.

It starts with the set of terminal commands on scripts called SleepWatcher. This program looks for a file called .sleep and .wakeup int he users home directory and executes them upon sleep and wake respectively. They can contain any UNIX script from say “Goodnight Michael” to, well, grabbing the current IP.

The command used to get the current IP and write it to a file is:

curl http://myip.ozymo.com -o /Users/michaelhutchins/Documents/Dropbox/wan_ip_mac.txt

With the /michaelhutchins… part replaced with your username and where you want the file to go (and be called). To make the use TextEdit or anything to make a file called sleep.txt. Then rename this to .sleep saying yes to all the warning of hidden files and removing the .txt extension. My full script is the above with one added line:

sleep 5;

curl http://myip.ozymo.com -o /Users/michaelhutchins/Documents/Dropbox/wan_ip_mac.txt;

The sleep 5 just waits five seconds so the computer can make the connection to the internet. Once it was done in Terminal I typed chmod +x .wakeup to make it executable. With this and sleepwatcher installed it now updated the IP address whenever it wakes up.

Why is this useful? I see it as a security measure. If my laptop is ever lost or stolen I can use the IP to SSH in to maybe find out where it went or at least narrow down the options. I can also use Screen Sharing through OS X to see what is on the screen by connecting with the IP address. Or if the IP is for a coffee house or public place a well placed “say “I am stolen!” on repeat may help.

Also in the future I may see about setting my computer up as a file server I can wake remotely in case I need to get a file. Though I have yet to experiment with that.

Read Full Post »

Dropbox

 

A long exposure shot of a UCSB beach.

A long exposure shot of a UCSB beach.

For my last lab report I was collaborating with my lab partner on data analysis, in the past we e-mailed the documents back and forth which resulted in several duplicates and on one occasion a misunderstanding because of file versions.

Then I joined him in using a program/web service called Dropbox. With Dropbox (the free version) I have 2 Gb of online storage for files. I designate folders on my computer and those folders and their contents are constantly synced with the online service so I can access them anywhere. Likewise if I had multiple computers the folders would stay in sync between them.

Important to my lab work my friend and I can share a folder where we both have access to contents. Secondly revisions are saved on the Dropbox server so if someone, say me, accidently overwrites an important file we can go back and restore the previous version. 

Overall I am really satisfied with the service and it would be perfect if it enabled the editing of the files online (even just basic text files) to keep an ongoing notes file.

In the end the impetus to make me join was that one day I forgot my flash drive and I could not work on my lab without any of my files, after that I quickly joined.

Read Full Post »