Posted by Brian @ 11:16 pm on May 6th 2011

Fix a NameError: global name ‘OPENOFFICE_BIN’ is not defined in LibreOffice

Just minutes ago I upgraded to Kubuntu 11.04. I noticed that OpenOffice has been replaced with LibreOffice (yay!) so I ran a critical python-based OpenOffice script that I use, expecting it to break. It did break, but the fix is easy.

Here’s the error that the script threw:
NameError: global name 'OPENOFFICE_BIN' is not defined

All I did was to locate where LibreOffice put itself and add that to the script. In my script there’s a section that looks like this:

# Find OpenOffice.
_oopaths=(
('/usr/lib64/ooo-2.0/program', '/usr/lib64/ooo-2.0/program'),
('/usr/lib/openoffice/program', '/opt/openoffice.org/basis3.1/program'),
)

See that first instance of /usr/lib64/ooo-2.0/program? I replaced it with /usr/lib64/libreoffice/program and now the script works perfectly. Never in a million years would I expect this with an upgrade from a proprietary vendor. Once again, free open source software just saved me lots of time and money.

New script looks like this:
# Find OpenOffice.
_oopaths=(
('/usr/lib64/libreoffice/program', '/usr/lib64/ooo-2.0/program'),
('/usr/lib/openoffice/program', '/opt/openoffice.org/basis3.1/program'),
)

Posted by Brian @ 11:45 am on March 27th 2011

Fix the black screen of death playing x264/h.264 mkvs on WD TV HD player

I have a Western Digital WD TV HD media player that I really like, even though it was quickly orphaned by Western Digital as a product. Maybe someday we’ll have legislation that requires a corporation to provide a guaranteed time of product support, including software updates and bug fixes.

Anyway, once in a while the WD refuses to play a video in the Matroska “mkv” format, particularly those using the H.264 codec encoded with the mkvmerge utility. When this happens the WD basically shows a black screen and more or less locks up. Once that happens on the WD you can only eject the HD and reboot.

The fix for this is to remove video compression on the mkv in question, which sounds daunting but really is only a one-line command that takes a couple of minutes to execute and doesn’t change the quality of the video. You need the mkvmerge program which is part of the mkvtoolnix package in Ubuntu. mkvtoolnix is also available for Windows if you’re stuck there.

Here’s the command:
mkvmerge -o output.mkv --compression -1:none input.mkv

Where input.mkv is your original file and output is the fixed file.
(Edited: I changed the command to remove /all/ compression in an mkv)

Posted by Brian @ 6:08 pm on March 7th 2011

After searching many years

My quest to find the lost city of snacks is finally at an end.

Posted by Brian @ 9:01 pm on February 23rd 2011

Batch convert all ape files to mp3 in Ubuntu

More reasons to love Linux:
for f in *.ape; do ffmpeg -i "$f" "${f%.ape}.mp3"; done

Posted by Brian @ 7:04 pm on January 22nd 2011

Bad doggie



Posted by Brian @ 6:45 pm on January 22nd 2011

Unexpected sight on the road

Driving in heavy rain the other day I did a double take as I saw this emerge from the mist.

Posted by Brian @ 11:23 pm on January 6th 2011

How to make Firefox stop asking if you want to open a .zip file and always save

This message in Firefox used to pop up every time I clicked on a zip file.

You have chosen to open
foobarbaz.zip
Which is a: BIN file

Firefox 3.x, for whatever reason, greyed out the option for me to tell it not to keep asking me if I wanted to unzip the file, and I’d have to click the “save to file” option every time.

Tired of trying to figure out how to ungrey the greyed-out button, I looked for another solution. I found one in /etc/mime.types, which Firefox, among other things, uses to determine what to do with a file.

sudo vi /etc/mime.types
look for this line:
application/zip zip
change it to:
#application/zip zip

You don’t even need to restart Firefox. Firefox will now just prompt you to save the zip file /only/.

Posted by Brian @ 9:01 pm on December 31st 2010

Gamemastering book finally complete

Five years, untold drafts, and 330 pages later I finally pressed the publish button on Amazon today for Gamemastering. I was an inch away from publishing it in 2009 but decided to spend more time polishing it.

I’ve got the website for the book all built out and I’m just waiting on the Amazon page to go live before I release the PDF to Creative Commons. From here on out all my blogging for the book will be kept on the official book site.

I have to say this really puts the cherry on top of a great 2010 for me.

Posted by Brian @ 12:46 pm on December 21st 2010

Fix the “Using fallback suid method” error message on Busybox (NSLU2)

When you ssh into a fresh SlugOSBE install on an NSLU2 device (or maybe anything running Busybox), an annoying error keeps popping up: “Using fallback suid method”

The simple fix to this is, as root:
touch /etc/busybox.conf

That’s it.

Posted by Brian @ 11:50 pm on December 4th 2010

How to configure WordPress for automatic ftps updates using vsftp in Ubuntu

This is a complete guide for setting up WordPress to do secure ftps updates under Ubuntu, tested under Ubuntu 10.10. I assume you have a working WordPress installation and sudo access on the server. If you have any ideas for improving the security of this, please let me know and I’ll update the guide.

Install the vsftp server software:
sudo apt-get install vsftpd

Edit the configuration file for vsftpd to enable ftps:
sudo vi /etc/vsftpd.conf
The following is my entire vsftp.conf file; I shut down anonymous access and even changed the port that vsftpd listens on to throw off low-level script attacks. I stripped out all the nice comments in the file to make this howto a bit more readable. If you paste this in be sure to delete everything else or make sure there aren’t any duplications:
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
anon_world_readable_only=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
connect_from_port_20=NO
listen_port=2112

Now start the vsftp server:
sudo start vsftpd

Add a bit of code to the wp-config file to enable uploads:
sudo vi /var/www/wp-config.php
Add the following code to the end:
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}

Now create the ftps user, making their default directory our web directory:
sudo adduser ftps --home /var/www
NOTE: Don’t worry about the warning about the home directory and give the ftps user a good, solid password. Use nonsense words, spaces, and characters like %,$,#. Store the password somewhere safe as you’ll be using this user and password to update WordPress.

Add the ftps user to the www-data group:
sudo vi /etc/group
In that file look for this line:
www-data:x:33:
and add the ftps user to the group by adding ‘ftps’ to the end of that line:
www-data:x:33:ftps

Change the www directory and all files in it to be owned by the www-data group
sudo chgrp -R www-data /var/www

Make the www directory writable by the www-data group
sudo chmod -R g+w /var/www

You can now do updates automatically. Host is the name of your website, plus the following “:2112″ – so if your website was foobar.com, you’d do this:
foobar.com:2112
Username is “ftps” and the password is what you chose earlier. Be sure to select “ftps” as the option. Enjoy!

Previous PageNext Page