Archive for 2015

Using the $lookup operator in MongoDB 3.2

I often loiter over on the MongoDB User Google Group and there was an interesting question posted the other day. The poster wanted to form a document like this from two collections (where foo is a document from another collection)… ?View Code JAVASCRIPT{ "_id" : ObjectId("ObjectId of this bar"), "name" : "Bar Name", "foo" : […]

Progress bars in BASH with pv

Way back in 2009 I wrote a post about how to display progress bars in Powershell. The same thing is possible in bash with pv. If it’s not available in your shell just do… ?View Code BASHyum install pv Or equivalent for your platform. The following example compresses a file into a tar archive reporting […]

Launch a MongoDB Cluster for testing

Here’s a bash script I use to create a sharded MongoDB Cluster for testing purposes. The key functions are mongo_setup_cluster and mongo_teardown_cluster. The script will created a Mongo Cluster with 2 shards, with 3 nodes each, 3 config server and 3 mongos servers. UPDATE 2015/10/02 I’ve found out about an undocumented option available to set […]

Partitioning setup for Linux from Scratch in VirtualBox

I’ve finally taken the plunge and committed, to untarring and compiling, a bucket load of source code to complete Linux from Scratch. I’ll be documenting some of my setup here. I’m far from an expert, that’s why I’m doing this, but if you have any constructive criticism I’d be glad to hear it. I’m using […]

Highlight text using Grep without filtering text out

Here’s a neat little trick I learned today I thought was worth sharing. Sometimes I want to highlight text in a terminal screen using grep but without filtering other lines out. Here’s how you do it… ?View Code BASHmysqlbinlog mysql-bin.000473 | grep –color -E ‘^|not closed’; The important part is the regexp in grep. The […]