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:

http://www.cyberciti.biz/faq/linux-scan-image-commands/

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...

http://news.ycombinator.com/item?id=1293849

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
File.open('/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"
  end

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

$ vagrant up

Verify it worked

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

simplify your life with SSH aliases

http://nerderati.com/2011/03/simplify-your-life-with-an-ssh-config-file/

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 http://files.vagrantup.com/precise32.box

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

$ mkdir mybase
$ cd mybase
$ edit Vagrantfile

Vagrant::Config.run do |config|
  config.vm.box = "precise32"
end

** boot new VM

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

$ 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

precise32

** fix networking

*** add nameserver

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

*** verify

$ vagrant ssh -c 'dig yahoo.com'

;; ANSWER SECTION:
yahoo.com.        3186    IN    A    98.139.183.24


** 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/package.box

** make a new VM with the better base

$ mkdir ../apple
$ cd ../apple
$ edit Vagrantfile

Vagrant::Config.run do |config|
  config.vm.box = "mybase"
end

** 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