Wednesday, August 22, 2012

Puppet Hiera

http://projects.puppetlabs.com/projects/hiera/


Heira
A simple pluggable Hierarchical Database.
Why? Hierarchical data is a good fit for the representation of infrastructure information. 

Linux tree command


ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/  /' -e 's/-/|/'


tree.sh

#!/bin/sh
######################################################
#  UNIX TREE                                         #
#  Version: 2.3                                      #
#  File: ~/apps/tree/tree.sh                         #
#                                                    #
#  Displays Structure of Directory Hierarchy         #
#  ------------------------------------------------- #
#  This tiny script uses "ls", "grep", and "sed"     #
#  in a single command to show the nesting of        #
#  sub-directories.  The setup command for PATH      #
#  works with the Bash shell (the Mac OS X default). #
#                                                    #
#  Setup:                                            #
#    $ cd ~/apps/tree                                #
#    $ chmod u+x tree.sh                             #
#    $ ln -s ~/apps/tree/tree.sh ~/bin/tree          #
#    $ echo "PATH=~/bin:\${PATH}" >> ~/.profile      #
#                                                    #
#  Usage:                                            #
#    $ tree [directory]                              #
#                                                    #
#  Examples:                                         #
#    $ tree                                          #
#    $ tree /etc/opt                                 #
#    $ tree ..                                       #
#                                                    #
#  Public Domain Software -- Free to Use as You Like #
http://www.centerkey.com/tree  -  By Dem Pilafian #
######################################################

echo
if [ "$1" != "" ]  #if parameter exists, use as base folder
  then cd "$1"
  fi
pwd
ls -R | grep ":$" |  \
  sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/  /' -e 's/-/|/'
# 1st sed: remove colons
# 2nd sed: replace higher level folder names with dashes
# 3rd sed: indent graph three spaces
# 4th sed: replace first dash with a vertical bar
if [ `ls -F -1 | grep "/" | wc -l` = 0 ]  # check if no folders
  then echo "  -> no sub-directories"
  fi
echo
exit

Thursday, August 16, 2012

7 Databases in 7 Weeks


Book: http://pragprog.com/book/rwdata/seven-databases-in-seven-weeks
Blog: http://sevenweeks.org/
Code: https://github.com/sevenweeks/databases
Song: http://sevenweeks.org/post/24891440010/lyrics-to-seven-databases-in-song

Contents


1. Introduction
1.1 It Starts with a Question
1.2 The Genres
1.3 Onward and Upward

2. PostgreSQL
2.1 That’s Post-greS-Q-L
2.2 Day 1: Relations, CRUD, and Joins
2.3 Day 2: Advanced Queries, Code, and Rules
2.4 Day 3: Full-Text and Multidimensions
2.5 Wrap-Up

3. Riak
3.1 Riak Loves the Web
3.2 Day 1: CRUD, Links, and MIMEs
3.3 Day 2: Mapreduce and Server Clusters
3.4 Day 3: Resolving Conflicts and Extending Riak
3.5 Wrap-Up
4. HBase
4.1 Introducing HBase
4.2 Day 1: CRUD and Table Administration
4.3 Day 2: Working with Big Data
4.4 Day 3: Taking It to the Cloud
4.5 Wrap-Up 5. MongoDB

5.1 Hu(mongo)us
5.2 Day 1: CRUD and Nesting
5.3 Day 2: Indexing, Grouping, Mapreduce
5.4 Day 3: Replica Sets, Sharding, GeoSpatial, and GridFS
5.5 Wrap-Up

6. CouchDB
6.1 Relaxing on the Couch
6.2 Day 1: CRUD, Futon, and cURL Redux
6.3 Day 2: Creating and Querying Views
6.4 Day 3: Advanced Views, Changes API, and Replicating
Data
6.5 Wrap-Up

7. Neo4J
7.1 Neo4J Is Whiteboard Friendly
7.2 Day 1: Graphs, Groovy, and CRUD
7.3 Day 2: REST, Indexes, and Algorithms
7.4 Day 3: Distributed High Availability
7.5 Wrap-Up

8. Redis
8.1 Data Structure Server Store
8.2 Day 1: CRUD and Datatypes
8.3 Day 2: Advanced Usage, Distribution
8.4 Day 3: Playing with Other Databases
8.5 Wrap-Up

9. Wrapping Up
9.1 Genres Redux
9.2 Making a Choice
9.3 Where Do We Go from Here

A1. Database Overview Tables
A2. The CAP Theorem
A2.1 Eventual Consistency
A2.2 CAP in the Wild
A2.3 The Latency Trade-Off