# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-3/dna.json
chef-shell -s -c /tmp/vagrant-chef-3/solo.rb -j /tmp/vagrant-chef-3/dna.json
knife data bag show --editor=/usr/bin/vim --secret-file=../../.chef/encrypted_data_bag_secret secrets ITEM
backup: mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore: mysql -u root -p[root_password] [database_name] < dumpfilename.sql
RAILS_ENV=qa nohup bundle exec rake sass:generate &
RAILS_ENV=qa nohup bundle exec rake fog_s3_copy[from-bucket,to-bucket,access_key_id,secret_access_key] &
/usr/sbin/passenger-status
/usr/sbin/passenger-memory-stats
scp -P 2222 -i .vagrant/machines/default/virtualbox/private_key file vagrant@localhost:/tmp
scp -i ~/.ssh/id_boot2docker -P 2022 file-to-upload docker@localhost:~
sudo eselect ruby set ruby19 && sudo /etc/init.d/nginx restart
Find search errors in rails log:
grep -C 10 "search" production.log | grep -C 50 "Completed 500 Internal Server Error"
To find the largest 10 files (linux/bash):
find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
To find the largest 10 directories:
find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}
Run top then press 'O' (capital letter o) followed by 'p' then 'enter'
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p353
http://www.markhneedham.com/blog/2012/09/29/upstart-job-getting-stuck-in-the-startkilled-state/
knife node show NODE_NAME -F json > NODE_NAME.json
knife node from file NODE_NAME.json
#!/usr/bin/env python
import boto
import boto.s3.connection
access_key = ''
secret_key = ''
bucket_name = ''
host = ''
conn = boto.connect_s3(
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
host = host,
#is_secure=False, # uncommmnt if you are not using ssl
calling_format = boto.s3.connection.OrdinaryCallingFormat(),
)
#newbucket = conn.create_bucket(bucket_name)
for bucket in conn.get_all_buckets():
print "{name}\t{created}".format(
name = bucket.name,
created = bucket.creation_date,
)
#bucket = conn.get_bucket(bucket_name)
#key = bucket.new_key('hello.txt')
#key.set_contents_from_string('Hello World!')
for key in bucket.list():
print "{name}\t{size}\t{modified}".format(
name = key.name,
size = key.size,
modified = key.last_modified,
)
azure vm image list canadacentral canonical ubuntuserver