Top Nav

Make vi Work On Ubuntu

Posting this because I always forget and have to goggle for the answer. The default “vi” installed with Ubuntu has terminal emulation problems on both Ubuntu Desktop and through putty. The fix is simple … install “vim” …

0

Install jpegtran on CentOS 7

CentOS uses the libjpeg-turbo fork of the original libjpeg project. So to install jpegtran do this:

 

0

Test CORS with curl

Is your CDN returning the proper CORS headers? One way to test is with curl. Here’s a simple CORS request:

You should get a successful response that includes and “Access-Control-Allow-Origin” header.

And here’s a pre-flight request:

You should get a successful response that includes and “Access-Control-Allow-Origin”, “Access-Control-Allow-Methods”, and “Access-Control-Allow-Headers” headers.

0

Get IP Address In A Script

Recently needed a good way to fetch the IP address of each interface within a script. Tried things like:

and

But this is fairly ugly. So I tried:

This gives a list of IP addresses but they are un-ordered so I can’t guarantee which address goes with which interface.  Here’s one using “ip addr”:

Still very messy.  Finally, found the “ifdata” command which is part of the “moreutils” package. First make sure “moreutils” is installed with:

Now you can query for a wide range of different information:

So here are some examples:

Overall this is much cleaner and more reliable then the earlier approaches.

0

Change WordPress User Password With WP-CLI

WP-CLI is a great tool for managing WordPress sites from the command line. As an example you can quickly change a WordPress user’s password with WP-CLI. This can be very handy on sites that you don’t have a WordPress admin login. First, if you don’t already have WP-CLI installed then follow the instructions here:

http://wp-cli.org/#installing

Then “cd” to the root of the WordPress site and run the following command:

Where <user> is the username and <pass> is the new password.

Here’s an example:

You can actually update other user parameters with the “user update” sub-command. See the full docs here:

http://wp-cli.org/commands/user/update/

 

 

 

0