Restore Dropbox Shell Extension in Nautilus for Gnome3

Dropbox works great on linux, but at some point the gnome 3 nautilus dropbox shell extension stopped working for me. The shell extension provides little icons over all the files in your dropbox folder indicating their status, and (more importantly in my opinion) the dropbox context menu which lets you link to files, especially those in your Public folder. Here is how you can manually install the very latest version of dropbox-nautilus for your version of Ubuntu.

Add the dropbox linus repository

echo “deb http://linux.dropbox.com/ubuntu $(lsb_release -cs) main” | sudo tee “/etc/apt/sources.list.d/dropbox.list” > /dev/null

Add the dropbox public key

sudo apt-key adv –keyserver pgp.mit.edu –recv-keys 5044912E

Get an updated repository list

sudo apt-get update

Get the latest source code for nautilus-dropbox

sudo apt-get source nautilus-dropbox

Install of the of the necessary dependencies

sudo apt-get build-dep nautilus-dropbox

Install some packages necessary for compiling software in general

sudo apt-get install build-essential dpkg-dev

Change directory into the directory created for your source code, mine was labelled “dropbox-1.4.0″

cd nautilus-dropbox-0.6.7/

The README and INSTALL files are good to review at this point, they go over the basics and details of installation this package.

Following the README, we’ll first configure the package.

sudo ./configure

Next we’ll compile it with make.

sudo make

And finally we’ll install.

sudo make install

At this point we have installed the latest version of nautilus-dropbox from source. We’ll have to stop all running instances of nautilus and then reopen it to see our changes.

killall nautilus

That’s it! Just run nautilus, or open your file browser as you normally would and you should have the latest version of dropbox’s shell extension up and running.

Using knockd port knocking to remote toggle SSH password auth

It is possible to remotely toggle ssh password authentication on your server using knock port knocking, for those times when you don’t have your SSH key. Knockd is port knocking server which listens at the link link-layer level of your ethernet device for a special series of “knocks” or port hits, and runs arbitrarily defined commands based on those knocks. It requires no open ports to function. This allows us to do some really cool stuff. Let’s work through one very useful real world example to give you some ideas.

Continue reading

Permanently delete your Twitter timeline with Python and Tweepy

Take back control of your data by automating the deletion of your twitter timeline posts using the power of python. Twitter isn’t very clear what it does with your data after you’ve “deactivated” your account, and even then you have to wait 30 days until it’s formally destroyed. If you’re very, very determined you can set about automatically deleting your tweets via their API. Unfortunately the API is rate limited to 350 operations per hour, so unless you’re able to run this script from multiple IPs, you’ll be limited to deleting 350 tweets per hour.

Continue reading

Prevent wordpress from generating smart quotes in your content

Disabling this wordpress feature to prevent smart quotes is quick and easy. We’re going to disable the wptexturize function for our theme by adding the following line to functions.php in our theme:

remove_filter(‘the_content’, ‘wptexturize’);

By default, wordpress is configured to use the wptexturize function which returns the given text with transformations of quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol. This means that you when you enter regular, straight “quotes”, either in Visual or HTML mode, they will be magically converted into the curly “smart quotes”. This is great if your blog is meant to be read, but if you’re providing code samples, those quotes will not work when copy and pasted.

SSH Public Key Authentication to access remote machines without a password

If you’ve already generated a ssh keypair, you can use it to access remote machines without the use of your password. You must have openssh running on both your local and remote machines (most linux machines comes with this installed by default), and you must provide the remote machine with your public key so that it can be compared against your private key at login time.

Continue reading

Create SSH Public and Private Keys

Generating an SSH keypair with ssh-keygen for password-less authentication is helpful in an endless number of ways and it’s quite easy to accomplish. First lets see if we have any existing keys and if so back them up and create new ones. SSH keys are generally held in ~/.ssh/id_rsa (private key) and ~/.ssh/id_rsa.pub (public key). If those files exist, make backup copies of them in another directory before continuing!

To generate SSH keys run the following command

ssh-keygen -t rsa -C “youremail@example.com”

Continue reading

SSH Aliases, save time, frustration, and keystrokes with SSH and SCP

If you’re tired of remembering and typing connection and login information when using SSH, aliases are what you’re looking for. SSH aliases allow you to save connection information for multiple connections including hostname, username, port, and public key, and boil it down into one easy to remember label. This works for SSH itself and anything that uses SSH like SCP or RSYNC! Let’s start this tutorial off with a quick example.

Continue reading

Converting m4a to mp3 with ffmpeg on linux

We’re going to write a quick script that will convert m4a files to mp3 files. FFMPEG is actually quite flexible though so if you have different file formats that need to be converted you can probably just swap them in without any other modifications. First things first, install some dependencies

sudo apt-get install ffmpeg libavcodec-extra-53

This installs ffmpeg and the libraries which allow you to work with mp3 files, among other codecs. It should be noted that libavcodec-extra may change or get updated after the time this article was written, so it’d be best to type “libavcodec-extra” and then hit tab to have the appopriate library name autocompleted for you.

Next we’re going to write a quick shell script which runs “ffmpeg -i input_filename.m4a -ab 256k output_filename.mp3″ for each .m4a file in the current directory. I’m entering mine into a file called m4a2mp3.sh and placing that file into the same directory as the .m4a files that I want to convert.

#!/bin/bash
for i in *.m4a
do
ffmpeg -i “$i” -ab 256k “${i%m4a}mp3″
done

The -ab argument stands for audio bitrate and controls the quality of the output file. You can specify any number of the common bitrates, from 64k all the way up to 128k, 256k, 192k, 320k, etc. Check the man page for specifics as needed.

Give the file execute permissions and run it to convert all files in the directory.

chmod +x m4a2mp3.sh
./m4a2mp3.sh

After you’ve gotten this script working, if you’d like to have it remove the original files as it converts, you can ammend the script like so:

#!/bin/bash
for i in *.m4a
do
ffmpeg -i “$i” -ab 256k “${i%m4a}mp3″ && rm “$i”
done

Careful though, if the conversion fails or doesn’t turn out as you expected, you may lose your originals. Always keep backups!

Download all files from directory listing with wget

If you run across a directory listing of files that you’d like to download all at once, you can use a couple wget arguments to help you. Use -m to enable mirroring (equivalent to -r -N -l info –no-remove-listing) and –no-parent to prevent wget from recursing up directories. This command will download everything in the current directory and all directories below it.

wget -m –no-parent http://example.com/path/to/files/

As usual, run man wget for more information.

Send text to clipboard in linux terminal

What we’d like to do is have a quick way of sending text to the clipboard from terminal in linux. We can accomplish this with pipes and xclip. We’ll install and configure xclip and then review the proper usage.

First we install xclip:

sudo apt-get install xclip

Next we want to configure an alias for xclip so that the arguments “-selection c” are used every time we call xclip. This ensures that the text is piped (copied) into the correct clipboard. This command will place the alias specification into the .bashrc file in our home directory.

echo “alias xclip=\”xclip -selection c\”” >> ~/.bashrc

Now we need to load our new .bashrc settings into the current window or open a new window.

source ~/.bashrc

Now we can use xclip as follows:

uptime | xclip

In my case I like being able to copy my public keys directly from file into github, so I use it like so:

cat ~/.ssh/id_rsa.pub | xclip

Information, tutorials, and code examples for linux, python, php and more