Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Installing dropbox on a headless linux machine

What you need for this guide

  • A headless linux machine.  This guide is intended for a debian-based system but may work on other distros.
  • Glance over the Dropbox linux install guide to get the jist of what we will do.
    • Decide if you need the x86 or x64 version based on your processor type.

How to set up dropbox

At the command line, you will run one of the two commands, based on your processor,


cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -


When it's done installing, we're going to want to initialize it,


~/.dropbox-dist/dropboxd


which will give us the following output


This computer isn't linked to any Dropbox account...
Please visit https://www.dropbox.com/cli_link_nonce?nonce=3f815ada4c4842c2aa7de9239072532e to link this device.


Copy the link (your link, not mine) and paste it to your browser, leave the command running during this process.  When it's linked, you should see the following output (where ____ is the name on your account),


This computer is now linked to Dropbox. Welcome ____.


Now, we're linked to Dropbox but we still want a way to control it easily.  We're going to want to download the python script, we'll put it in the same installation folder we just created to keep things tidy. (Note, if you don't have python installed, you need to install it now.)


wget -O ~/.dropbox-dist/dropbox.py https://www.dropbox.com/download?dl=packages/dropbox.py


To create a nice shortcut to launch the dropbox script, you can create an alias like so,


alias dropbox='python ~/.dropbox-dist/dropbox.py'


Don't forget to add it to your .bashrc file if you want it to be available next time you log in.  With the alias created, we can now access dropbox easily.

Using dropbox


~$ dropbox

Dropbox command-line interface

commands:

Note: use dropbox help <command> to view usage for a specific command.

status get current status of the dropboxd
help provide help
puburl get public url of a file in your dropbox
stop stop dropboxd
running return whether dropbox is running
start start dropboxd
filestatus get current sync status of one or more files
ls list directory contents with current sync status
autostart automatically start dropbox at login
exclude ignores/excludes a directory from syncing
lansync enables or disables LAN sync


To kick things off, you begin with


dropbox start


To check on the status, use


dropbox status
 

Don't be alarmed if the status stays in "Starting" for a long time the first time you run it.

If you have the same dropbox account installed on other machines on your network, you can speed up your sync and decrease your bandwidth usage by letting dropbox sync using the files already on your other machine(s).  You can enable lansync like so,


dropbox lansync y
 

The linux version of dropbox will put all of your files into the following location ~/Dropbox.  If you don't want to sync your entire dropbox folder, you can have it exclude folders and files like so,


dropbox exclude add ~/Dropbox/FolderToExclude
 

If you copy some stuff into your dropbox and you're waiting to see if it's ready yet, you can execute the following command,


watch -n 30 python ~/.dropbox-dist/dropbox.py status
 

This will output your dropbox status every 30 seconds and will show "Up to date" when you are synched.

Turn your Raspberry Pi into a white noise machine

What you need for this guide

  • A Raspberry Pi with debian* installed
  • The Internet
  • A 3.5mm male-to-male ("headphones"-style) audio cable
  • An old stereo with auxiliary input
**This guide is based on debian/raspian however it may work in another distro.

How to set up the Pi

With your Pi connected to the internet, at the command line type in


sudo apt-get update
sudo apt-get install sox
export AUDIODEV=hw:0,0
export AUDIODRIVER=alsa


This installs sox and set the environment variables needed for the Pi to find your audio device.

Now open the startup jobs list,


sudo nano /etc/crontab


and insert the following text into a new line at the end of the file.


@reboot pi play -b 16 -n synth 0 brownnoise


Close the file and save.  This will create brown noise, which I find more soothing than white but you can also use white noise or pink noise by replacing "brownnoise" with "whitenoise" or "pinknoise".  Note that we are specifying 16bit output because 32 is not supported.

The final steps


The sound we selected will now automatically start playing on boot. Plug your 3.5mm cable from the Pi into your stereo and plug in the power cable.  Note that it will take a minute for your Pi to boot up before you get any audio.  Turn on the stereo and adjust your bass and treble levels to your preference so that the noise generated is exactly how you want it.

Some Considerations


While you may need a keyboard, ethernet, and monitor to set up the script, presumably, you're going to want to plug in only the audio and power cables when you actually set it up to your stereo.  This means you will not have a way to properly shut down the Pi when you want to turn it off.  Turning off the Pi without shutting down has a small chance of damaging data on the memory card and making the Pi unable to boot.  For this reason, you should try to avoid turning off the Pi unnecessarily.  You might also consider backing up your memory card.

Enjoy!