Installing a Printer in a Windows 7 Virtual Machine with an Ubuntu Host

I recently needed to print a document using a website that wanted to run a Java applet on a Windows machine. After a bit of work I had a Windows 7 virtual machine guest printing to a printer connected to the Ubuntu host machine. I’ll go through the steps to do this here in case I need to do it again or someone else is stuck trying to accomplish the same thing.

Taking Webcam Photos Via the Command Line

Here’s an easy way to use your default webcam to take a photo with a single command from a terminal: mplayer -vo png -frames 1 tv:// I wanted a quick and easy way to take a photo with my laptop’s webcam and upload it to my server on a regular basis when I’m away from my machine. Side note: this wasn’t to take photos of unknowing human victims, but to check in on my dogs :).

How to Create an eBook from Wikipedia

Wikipedia makes it very simple to create an eBook from articles on the site: Go to the Book creator page to start a book by clicking “Start book creator” Visit any pages you want to add to the book and click “Add this page to your book” at the top Click “Show book” at the top of the page when you are done Select which format (currently PDF, ODT, OpenZIM or EPUB) and then click “Download” If you’re looking for a way to convert your EPUB Wikipedia eBook to MOBI for a Kindle, check out Calibre.

Mining Bitcoin with a 2012 MacBook Pro

So I started researching bitcoin mining and the feasibility of doing it with a laptop. The machine in question is a mid-2012 MacBook Pro. From what I have read, it’s not worth mining bitcoins (or any other semi-mature) cryptocurrencies on a MacBook Pro. I don’t think I’m up to the task of buying an ASIC miner, but that’s essentially what you should do now to even recoup what you spend on electricity.

Screenshot Sharing Script for Mac OS

I recently wanted to move away from commercial screenshot sharing tools (I was using Jing), so I decided to create a script that takes screenshots, allows you to annotate them, then uploads them to a free webhost. The free host I use is 000webhost.com and I use ftp to upload the image. Here’s the script: #! /bin/bash d=`date +%Y%m%d%I%M%S` host="http://tr99.host56.com/" password="*******" screencapture -i $d".png"; open $d".png" #edit? read go; echo "put "$d.

Get a random file from a directory with the Linux terminal

Here’s how you can grab a random file from a directory using the GNU/Linux terminal: ls | shuf -n 1 And perhaps you want to do something like open that file with a program: your_program `ls | shuf -n 1` I used this to do things like open a random image with feh from my pictures folder: cd Pictures; feh `ls | shuf -n 1` The magic here is the shuf command that will output n pseudorandom items from a collection that is fed to it.

Nginx and “413 Entity too large.”

That’s what she said! Okay, okay, here’s how to fix an “entity too large” error with nginx. Add this to your server block: client_max_body_size 10M; where 10M is the size of uploads you want to allow. The default is 2 MB, but as you know people have smartphones that take larger pictures than that now. Just remember you should probably resize them for web display until we all have better download speeds.

Changing the default session in Elementary OS

I installed Elementary OS a few months ago, but moved back to Ubuntu for some reason or another. A couple days ago I decided to give Elementary OS another try. Well, tonight I finally started missing openbox too much and decided to install it and give up on Elementary’s default desktop manager. Once I installed openbox, I logged out and noticed that the greeter didn’t have a way to change the session.

SQLite 3 and PHP - "unable to open database file"

While playing with SQLite 3 and PHP, I encountered an oddity: the SQLite database file must be writable AND be in a writable directory. So if you’re running SQLite commands from within a PHP web page, the directory your database is in and the database itself must be writable by your www user. With most GNU/Linux distros, this would take care of it: sudo chown yourusername:www-data -R /path/to/db sudo chmod 775 -R /path/to/db/yourdb.

Automatically Mount a Drive when Linux Boots

If you want to have a drive (more specifically, a partition) mount when a GNU/Linux distro boots, simply add it to your /etc/fstab file. The fstab for Ubuntu usually looks like this: # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed.