#!/usr/bin/env coffee
# Add document
mongo = require 'mongodb'
server = new mongo.Server "127.0.0.1", 27018, {}
client = new mongo.Db 'test', server
"MongoDB will create collections and databases implicitly upon their first use: you do not need to create the database or collection before inserting data."
Look closely at Fri May 31 03:10:53.198 through Fri May 31 03:10:55.837 All of that work being done, time being spent, those 2+ seconds, is MongoDB performing initial setup creating the collection required to store the first document I'm adding to that collection.
So: Although "you do not need to create the database or collection before inserting data" you do need to expect that the very first document you add will include a few seconds of setup time.
# mongod run --port 27018 --quiet --nojournal --dbpath environments/test/data/mongo
Fri May 31 03:10:24.292 [initandlisten] MongoDB starting : pid=6313 port=27018 dbpath=environments/test/data/mongo 64-bit host=ip-10-172-51-100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruby Total: 17 | |
~ > pry | |
[4] pry(main)> def add(a,b) | |
[4] pry(main)* a+b | |
[4] pry(main)* end | |
=> nil | |
[5] pry(main)> add(1,1) | |
=> 2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x | |
ps axfu | grep -iE 'ruby|java|node|redis|mongo|cassandra' | |
/etc/init.d/redis-server stop | |
/etc/init.d/mongodb stop | |
/etc/init.d/cassandra stop | |
rm -rf /var/lib/cassandra/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Target OS: Debian | |
# Install Cassandra 1.1.x | |
sh -c 'echo deb http://www.apache.org/dist/cassandra/debian 11x main >> /etc/apt/sources.list.d/cassandra-stable.list' | |
sh -c 'echo deb-src http://www.apache.org/dist/cassandra/debian 11x main >> /etc/apt/sources.list.d/cassandra-stable.list' | |
gpg --keyserver keyserver.ubuntu.com --recv-keys 4BD736A82B5C1B00 | |
gpg --export --armor 4BD736A82B5C1B00 | apt-key add - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Target OS: Debian | |
# Install rbenv, ruby-build, ruby | |
# Update, upgrade and install development tools: | |
apt-get -qy update | |
apt-get -qy upgrade | |
apt-get -qy install build-essential git-core curl libssl-dev \ | |
libreadline5 libreadline5-dev \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts RUBY_VERSION | |
# puts the ruby load path | |
puts $: | |
Object.constants.sort.each {|c| cv=Object.const_get(c); print c, "=", cv, "\n" unless Module === cv} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Add 10gen Debian repository to apt sources | |
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
echo -e "\n# 10gen\ndeb http://downloads-distro.mongodb.org/repo/debian-sysvinit\tdist 10gen" >> /etc/apt/sources.list | |
apt-get update -y | |
# Install misc packages | |
apt-get install -y vim tmux psmisc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# On a new / clean installation of debian squeeze | |
# Install Ruby from source | |
# Create a Debian package using FPM | |
# Update apt | |
apt-get update -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[14] pry(main)> cd a | |
[15] pry(#<Fog::Compute::AWS::Server>):1> ls | |
Fog::Attributes::InstanceMethods#methods: _dump attributes dup identity identity= merge_attributes new_record? requires requires_one | |
Fog::Model#methods: collection collection= connection connection= inspect reload symbolize_keys to_json wait_for | |
Fog::Compute::Server#methods: scp scp_download scp_upload ssh ssh_port sshable? | |
Fog::Compute::AWS::Server#methods: addresses ami_launch_index ami_launch_index= architecture architecture= availability_zone availability_zone= block_device_mapping block_device_mapping= client_token client_token= console_output created_at created_at= destroy dns_name dns_name= flavor flavor= flavor_id flavor_id= groups groups= iam_instance_profile iam_instance_profile= iam_instance_profile_arn= iam_instance_profile_name= id id= image_id image_id= instance_initiated_shutdown_behavior instance_initiated_shutdown_behavior= ip_address kernel_id kernel_id= key_name key_na |