Monday, October 29, 2012

automatic scanning of paper documents

 It used to be that scanners were tricky to attach to Linux. No more.  My faithful Canon MX700 prints without hassle, scans using 'xsane', does batch scanning!

Here's the magic to do scanning from the automatic feeder:

scanimage --format=tiff --batch='page%02d.tif'  --source='Automatic Document Feeder'
more info:

Sunday, October 28, 2012

DevOps people are worth their weight in platinum

One guy had an issue where if you loaded up a pallet full of shampoo, the database server would start having timeouts...

Sunday, October 21, 2012

notes: Simple Chef with Vagrant

(placeholder for Chef & Vagrant article)


install Vagrant and Chef in Ubuntu

$ sudo apt-get install vagrant chef

$ chef-client -v
Chef: 10.12.0

install Knife

$ knife configure

$ edit ~/.chef/knife.rb

cookbook_path [ './site-cookbooks' ]

use Knife to create a Cookbook

$ knife cookbook create beer
** Creating cookbook beer
** Creating README for cookbook: beer
** Creating CHANGELOG for cookbook: beer
** Creating metadata for cookbook: beer

When the "beer" cookbook runs, it creates a file in /tmp

$ edit site-cookbooks/beer/recipes/default.rb'/tmp/beer.txt', 'w') {|f| f.write('tasty\n') }

Tell Vagrant to use Chef, and to run "beer" recipe

$ edit Vagrantfile
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "site-cookbooks"
     chef.add_recipe "beer"

Boot the VM, thus running chef-client and our beer recipe

$ vagrant up

Verify it worked

$ vagrant ssh -c 'cat /tmp/beer.txt'

simplify your life with SSH aliases

notes: Vagrant

(placeholder for Vagrant article)

* Vagrant

Vagrant lets you fire up multiple virtual machines (VMs) inside your normal
computer.  This lets you test multiple operating systems, or to switch
back to old projects. A virtual machine will have all the right
versions of the right packages installed, so you concentrate on
development, not on fiddling with the system.

It's easy to create a 'base' VM with specific changes.  Then create a
new VM based on this, make changes, and wipe them away easily.  This
is fantastic for testing: you can guarantee the VM is "clean", having
exactly what you want on it and nothing more.

** install Vagrant

$ sudo apt-get install vagrant

** tell Vagrant about Ubuntu Precise Pangolin

This takes a while, as it downloads a ~700MB ISO.

$ vagrant box add precise32

** create a new VM, using 'precise32' as a base

$ mkdir mybase
$ cd mybase
$ edit Vagrantfile do |config| = "precise32"

** boot new VM

This will take a while, as Ubuntu installs itself to the virtual

$ vagrant up

[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!

** test new VM

$ vagrant ssh -c hostname


** fix networking

*** add nameserver

$ vagrant ssh -c 'sudo bash -c "echo nameserver > /etc/resolv.conf"'

*** verify

$ vagrant ssh -c 'dig'

;; ANSWER SECTION:        3186    IN    A

** add important packages to the base VM

$ vagrant ssh -c 'sudo apt-get -y install fortune-mod vim'

** package base box with changes, make available for re-use

$ vagrant package    # takes about a minute

$ vagrant box add mybase $PWD/

** make a new VM with the better base

$ mkdir ../apple
$ cd ../apple
$ edit Vagrantfile do |config| = "mybase"

** boot new VM and test it

$ vagrant up    # takes a couple minutes

$ vagrant ssh -c fortune

The man who sets out to carry a cat by its tail learns something that
will always be useful and which never will grow dim or doubtful.
        -- Mark Twain