Blog: TTTThis

Qemu Virtual Machine Manager (KVM)

After VirtualBox turned bad (everyone says it's much slower, and it can't even be installed on lots of OSs anymore), people are turning to Qemu, which is better anyway because it's FOSS.

It uses qcow2 files (currently), not .vdi files (which VirtualBox uses). You can 'migrate' .vdi files to become qcow files (use your old VirtualBox VMs in Qemu) but I haven't done that yet.

Install was not simple, but did work.

To make shared folders in the current Qemu, you have to go to Memory > checkmark on 'Enable shared memory', then click the button at the bottom of the list 'Add hardware', then go to 'File System' and here you keep driver as 'virtiofs' (this is just for LinuxHost-LinuxGuest, I've read, not for Windows). Set your source path (yes the actual path) to where you want your sharedFolder to be on your Host (create this folder also). For Target path, just put the NEWdIRECTORYnAME of the folder on your Guest (don't put the actual path to it, just the name). ... Now inside the GuestOS, do sudo mkdir path/to/your/NEWdIRECTORYnAME ... then (still inside the Guest, do sudo mount -t virtiofs NEWdIRECTORYnAME /path/to/your/NEWdIRECTORYnAME (the first name has to be the same as you entered in your Qemu settings a minute ago). Now it should be working on both sides.


Crop edges off photos (ImageMagick)

(If you want to screenshot first, and want to rotate the screen: xrandr -o left (and use xrandr -o normal to return to regular view).)

Open Terminal in the folder with all the images and

convert *.png -shave 90x280 shaved*.png

Convert pdf to text (several-step process)

Uses qpdf, imagemagick, ocrmypdf, and pdftotext.

0 Rename pdf to orig.pdf

1 Extract the paragraph from the pdf

  • qpdf orig.pdf --pages . 100-110 -- just-the-chapter.pdf

2 Create vr.pdf (VeryReadable)

  • convert -density 288 just-the-chapter.pdf output-%02d.jpg
  • convert output*.jpg -level 25% final-%02d.jpg
  • convert final*.jpg vr.pdf

3 Create text layer on vr.pdf as a new pdf

  • ocrmypdf -l spa vr.pdf vr-layer-spa.pdf

4 Convert that new pdf to .txt

  • pdftotext -layout vr-layer-spa.pdf chapter-spa.txt

5 Delete everthing except the new txt file and the new layered pdf * rm output* && rm final* && rm vr.pdf && rm just-the-chapters.pdf

All at once:

qpdf orig.pdf --pages . 318-419 -- just-the-chapters.pdf && convert -density 288 just-the-chapters.pdf output-%02d.jpg && convert output*.jpg -level 25% final-%02d.jpg && convert final*.jpg vr.pdf && ocrmypdf -l spa vr.pdf bookonech9-10.pdf && pdftotext -layout bookonech9-10.pdf bookonech9-10.txt && rm output* && rm final* && rm vr.pdf && rm just-the-chapters.pdf


Convert pdf to text (OCRmyPDF)

It relies on tesseract for its OCR (, so you need tesseract's language packs ( to do other languages.

"OCRmyPDF that will add a text layer to a scanned PDF making it searchable"


sudo apt-get install ocrmypdf

ocrmypdf input.pdf output.pdf

SPANISH (characters, otherwise it won't be able to copy-paste ¿)

ocrmypdf -l spa input.pdf output-spa.pdf


Colorizing black and white photos in (Gnu Image)

  • Make a gradient of dark blue and light blue
  • Colors > Map > Gradient
  • (NOTE you can also do this by Windows > Dockable dialogs > Palette, and drag over some colors dark to light, then do Map > Palette, which gives you a more rangy color effect)
  • (NOTE or you can do Colors > Colorize) THEN
  • r-click blue layer > Add layer mask > Black full transparency
  • Now you can use any tool (pen, airbrush, square and fill) and create that color