Secure Copy

If you’re logged in to a server via SSH, you can securely copy a file using SCP command tool or also known as “secure copy” to your local desktop, and vice versa. SCP uses SSH for data transfer, authentication and security. Here are several examples on how to use the SCP command line tool if you would like to securely transfer a file to and from your server. You’ll be asked for the user’s password for authentication.

Examples

# Copy the file "foobar.txt" from a remote host to the local host
$ scp username@remotehost.com:foobar.txt /your/local/directory
# Copy the file "foobar.txt" from the local host to a remote host
$ scp foobar.txt username@remotehost.com:/some/remote/directory

The downside of using SCP is that it is slow. It has been known to be slow. Here’s a quote from Spikelab’s blog.

SCP and the underlying SSH2 protocol implementation in OpenSSH is network performance limited by statically defined internal flow control buffers. These buffers often end up acting as a bottleneck for network throughput of SCP, especially on long and high bandwidth network links.

Despite the poor performance, it’s really not that bad with a tiny bit of patience.

The tradeoff is that you can safely transfer files without sacrificing your security.

Install S3cmd on Mac

Previously, I wrote about installing and accessing Amazon S3 (Simple Storage Service) from Ubuntu using s3cmd command line tool. Interestingly enough, the S3cmd command line tool is also available on the Mac, since MacOS is based on NeXT, which was based on BSD, which is a major variant of Unix. Anyways, you can install s3cmd on the Mac so you can access to Amazon S3 via the command line.

How to Install

$ sudo sudo python setup.py install

Configure

$ s3cmd --configure

The configuration will ask you to provide your access key and secret key. You can get those keys from your AWS account or your AWS administrator.

Once it’s configured and you have access to the S3, you can try the following commands.

# list the files
$ s3cmd ls 
# get file sizes in human form
$ s3cmd du -H s3://yourbucket
# create a new bucket
$ s3cmd mb s3://newbucket
# put file into bucket
$ s3cmd put filename.ext s3://bucket/folder
# get file from bucket
$ s3cmd get s3://yourbucket/yourfolder/yourfile
# delete file from bucket
$ s3cmd del s3://yourbucket/yourfolder/yourfile

There are a lot more commands you can explore. Here’s the documentation.

Override WordPress Video Dimensions

WordPress comes with its own media player. It supports M4a, MP4, OGG, WebM, FLV, WMV, MP3, WAV and WMA formats. In addition, you can also embed videos from a dozen external sites such as YouTube, Vimeo, etc. WordPress will automatically embed the video when you add it to your post. You can change the dimensions of your videos by overriding the width and the height of the media player.

Edit the functions.php file, and add the following code.

function override_video_dimensions( $out, $pairs, $atts ) {
  $out['width'] = '640';
  $out['height'] = '360';
  return $out;
}
add_filter( 'shortcode_atts_video', 'override_video_dimensions', 10, 3 );

Here’s how to add YouTube videos in WordPress.

Ghost Blogging Platform

I wanted to try Ghost, a CMS and blogging platform, which is an alternative for WordPress. Unlike WordPress which runs on PHP, Ghost runs on top of Node.js, a fast, scalable and extremely efficient Javascript runtime platform. Ember.js is used for the administration area making for a slick and smooth user experience. Ghost uses Handlebars, a powerful and logicless templating language.

Installation of Ghost on Digital Ocean is a breeze since there’s already a one-click Ghost app available from a list of ready-to-made list of app images. You can get a Ghost site up and running in less than 2 minutes.

How does it compare to WordPress?

If you’re new to blogging and you want something setup fast, Ghost may very well be your blogging platform. It’s has a simple but yet powerful interface. If you’re WordPress user, you may find the simplicity a little bit underwhelming. As far as themes and plugins, you will need to search for them online. There are free and paid Ghost themes.

If you’re thinking about extending the functionality of Ghost, you’ll need to learn Javascript. There are also dozens of apps online that you can install. Ghost is not as robust as WordPress, but if you want a no-nonsense blog, give Ghost a try. You may like it more than WordPress.