Puppet manifests major components

• Resources: Individual configuration items
• Files: Physical files you can serve out to your agents
• Templates: Template files that you can use to populate files
• Nodes: Specifies the configuration of each agent
• Classes: Collections of resources
• Definitions: Composite collections of resources

Git: Combine commits

# Go back to the last commit that we want to form the initial commit (detach HEAD)
git checkout

# reset the branch pointer to the initial commit,
# but leaving the index and working tree intact.
git reset –soft

# amend the initial tree using the tree from ‘B’
git commit –amend

# temporarily tag this new initial commit
# (or you could remember the new commit sha1 manually)
git tag tmp

# go back to the original branch (assume master for this example)
git checkout master

# Replay all the commits after B onto the new initial commit
git rebase –onto tmp

# remove the temporary tag
git tag -d tmp

http://stackoverflow.com/questions/435646/how-do-i-combine-the-first-two-commits-of-a-git-repository/436530#436530

http://stackoverflow.com/questions/598672/git-how-to-squash-the-first-two-commits

Android Java OCR

Get the following error when compiling javaOCR(http://sourceforge.net/projects/javaocr)

[INFO] android camera utils ………………………… SUCCESS [3.743s]
[INFO] Android sampler …………………………….. FAILURE [3.478s]
[INFO] Android trainer …………………………….. SKIPPED
[INFO] Android recognizer ………………………….. SKIPPED
[INFO] javaocr distribution project …………………. SKIPPED

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0:generate-sources (default-generate-sources) on project javaocr-sampler: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.2.0:generate-sources failed: Could not find tool ‘aapt’. Please provide a proper Android SDK directory path as configuration parameter … in the plugin . As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=… or set environment variable ANDROID_HOME. -> [Help 1]

This errors is because the new android sdk requires the android-maven-plugin version 3.6.0 or higher(it was 3.2.0 in the javaOCR source code). So changing the android-maven-plugin version to 3.6.0 in the pom.xml files fixes the problem.
demos/sampler/pom.xml:21:
android-maven-plugin
3.2.0

Also
http://stackoverflow.com/questions/16927306/could-not-find-tool-aapt-please-provide-proper-android-sdk-directory-path-as-co

Keyboard Shortcuts for Bash

Movement
Ctrl + A	Go to the beginning of the line you are currently typing on
Ctrl + E	Go to the end of the line you are currently typing on
Alt  + F	Move cursor forward one word on the current line
Alt  + B	Move cursor backward one word on the current line

Delete
Ctrl + W	Delete the word before the cursor
Alt  + D	Delete the word after the cursor
Ctrl + U	Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + K	Clear the line after the cursor
Ctrl + H	Same as backspace
Ctrl + L        Clears the Screen, similar to the clear command

Swap
Ctrl + T	Swap the last two characters before the cursor
Esc  + T	Swap the last two words before the cursor

Other
Ctrl + R	Let’s you search through previously used commands
Ctrl + C	Kill whatever you are running
Ctrl + D	Exit the current shell
Ctrl + Z	Puts whatever you are running into a suspended background process. fg restores it.

Tab	Auto-complete files and folder names

Install munin on RHEL6

1. Here is a list of modules munin depends on:
compat-readline5-5.2-17.1.el6.x86_64.rpm
libdbi-0.8.3-3.1.el6.x86_64.rpm
perl-Cache-Cache-1.06-2.el6.noarch.rpm
perl-Cache-Memcached-1.28-2.el6.noarch.rpm
perl-Carp-Always-0.09-2.el6.noarch.rpm
perl-Crypt-DES-2.05-1.x86_64.rpm
perl-DateTime-0.5300-1.el6.x86_64.rpm
perl-FCGI-0.74-1.x86_64.rpm
perl-File-Copy-Recursive-0.38-4.el6.noarch.rpm
perl-IO-All-0.39-4.el6.noarch.rpm
perl-IO-Socket-INET6-2.56-4.el6.noarch.rpm
perl-IPC-ShareLite-0.13-4.el6.x86_64.rpm
perl-Log-Dispatch-2.27-1.el6.noarch.rpm
perl-Log-Dispatch-FileRotate-1.19-4.el6.noarch.rpm
perl-Log-Log4perl-1.30-1.el6.noarch.rpm
perl-Mail-Sender-0.8.16-3.el6.noarch.rpm
perl-Mail-Sendmail-0.79-12.el6.noarch.rpm
perl-MIME-Lite-3.027-2.el6.noarch.rpm
perl-Net-CIDR-0.14-1.el6.noarch.rpm
perl-Net-Server-0.99-1.el6.rf.noarch.rpm
perl-Net-SNMP-5.2.0-1.2.el6.rf.noarch.rpm
perl-Net-SSLeay-1.36-1.el6.rfx.x86_64.rpm
perl-rrdtool-1.4.7-1.el6.rfx.x86_64.rpm
perl-String-CRC32-1.4-9.el6.x86_64.rpm
perl-Taint-Runtime-0.03-9.el6.x86_64.rpm
perl-XML-LibXML-1.70-5.el6.x86_64.rpm
perl-XML-NamespaceSupport-1.10-3.el6.noarch.rpm
perl-XML-SAX-0.96-7.el6.noarch.rpm
readline-6.0-3.el6.x86_64.rpm
rrdtool-1.4.7-1.el6.rfx.x86_64.rpm
ruby-1.8.7.352-7.el6_2.x86_64.rpm
ruby-libs-1.8.7.352-7.el6_2.x86_64.rpm
ttmkfdir-3.0.9-32.1.el6.x86_64.rpm
xorg-x11-fonts-Type1-7.2-9.1.el6.noarch.rpm

2. munin packages:
munin-2.0.12-2.el6.noarch.rpm
munin-common-2.0.12-2.el6.noarch.rpm
munin-node-2.0.12-2.el6.noarch.rpm

3. munin node setup
Configure the node to allow our main server get input from this machine. For this purpose, we need to add ‘Allow IP ADDRESS’ line in config file. Note that there’s already a Allow line which allow localhost to get values, we just need to add another line for server:

$ vi /etc/munin/munin-node.conf

allow ^192\.168\.0\.1$
Here 192.168.0.1 (change it as per your settings) is the IP of server machine, written in regex form which is required here.

4. start munin node
$ chkconfig munin-node on
$ service munin-node start

5. munin server setup
Configure /etc/munin/munin.conf for monitoring localhost:

$ vi munin.conf

htmldir /etc/munin/html
[localhost]
address 127.0.0.1
use_node_name yes

6. Monitoring node on server
update /etc/munin.conf and add a new section:

$ vi /etc/munin.conf

[App_Server]
address 192.168.0.5
use_node_name yes

Here, App_Server is the name (you can write any), and 192.168.0.5 is the IP address of the machine in which we configured munin-node.

7. After a while, Check you browser(http://server/munin) and munin should include the update from node machine.

Using netperf

netperf was used with the following parameters :
root@server:~# netperf -t omni -H 10.1.10.2 -l 30 -T 1/1 -c -C — -m 512k -V
What are these options?
-t omni specifies the netperf-test to use. This sends a single data-stream between two hosts.
-H 10.1.10.2 the destination-server’s IP address
-l 30 the duration of the test (30 seconds)
-T 1/1 to pin the applications on the client and the server side to CPU 1.
-c -C output statistics on the CPU-usage at the end of the test
-m 512k specifies the size of the send-buffer
-V use zero-copy send and receive

Teach Yourself Programming in Ten Years

http://norvig.com/21-days.html?

Answers

Approximate timing for various operations on a typical PC:
execute typical instruction 1/1,000,000,000 sec = 1 nanosec
fetch from L1 cache memory 0.5 nanosec
branch misprediction 5 nanosec
fetch from L2 cache memory 7 nanosec
Mutex lock/unlock 25 nanosec
fetch from main memory 100 nanosec
send 2K bytes over 1Gbps network 20,000 nanosec
read 1MB sequentially from memory 250,000 nanosec
fetch from new disk location (seek) 8,000,000 nanosec
read 1MB sequentially from disk 20,000,000 nanosec
send packet US to Europe and back 150 milliseconds = 150,000,000 nanosec