eg: api.countrycars.com.au tunnel through norm.omg.com.au
on local machine
ssh -f aandal@localhost -L 1337:api.countrycars.com.au:80 -N
-L: -N: no commands
create ssh tunnel to target website
| Online liner commit running container, then squashed image | |
| docker save $(docker commit supatest supatest) | docker-squash -t supatest -verbose | docker load | |
| One liner to stop / remove all of Docker containers: | |
| docker stop $(docker ps -a -q) | |
| docker rm $(docker ps -a -q) | |
| Remove all non-running container | |
| sudo docker ps -a | grep 'Exited' | awk '{print $1}' | xargs --no-run-if-empty sudo docker rm |
| wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc | sudo apt-key add - | |
| sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list' | |
| sudo apt-get update | |
| sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-4.3 dkms | |
| cd /tmp | |
| wget http://download.virtualbox.org/virtualbox/4.3.20/Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack | |
| sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack | |
| wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb | |
| sudo dpkg -i vagrant_1.7.2_x86_64.deb |
| Host bitbucket.org | |
| HostName bitbucket.org | |
| PreferredAuthentications publickey | |
| IdentityFile ~/.ssh/id_rsa | |
| Host me.bitbucket.org | |
| HostName bitbucket.org | |
| PreferredAuthentications publickey | |
| IdentityFile ~/.ssh/pangkalizer |
| desc "tail production log files" | |
| task :tail_logs, :roles => :app do | |
| trap("INT") { puts 'Interupted'; exit 0; } | |
| run "tail -f /var/log/nginx/access.log" do |channel, stream, data| | |
| puts # for an extra line break before the host name | |
| puts "#{channel[:host]}: #{data}" | |
| break if stream == :err | |
| end | |
| end |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
eg: api.countrycars.com.au tunnel through norm.omg.com.au
on local machine
ssh -f aandal@localhost -L 1337:api.countrycars.com.au:80 -N
-L: -N: no commands
create ssh tunnel to target website
| sudo apt-get install openjdk-7-jre-headless -y | |
| sudo wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - | |
| # add the following line to /etc/apt/sources.list | |
| deb http://packages.elasticsearch.org/elasticsearch/1.2/debian stable main | |
| sudo apt-get update | |
| sudo apt-get install elasticsearch | |
| sudo update-rc.d elasticsearch defaults 95 10 |
| http://localhost:3000/oauth/authorize?redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&client_id=e0788a7508a06408a6bf7ea9addbea21c1f54a6b1110e70cd13bd8c53c329ede&response_type=code | |
| http://localhost:3000/oauth/token?redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&client_id=e0788a7508a06408a6bf7ea9addbea21c1f54a6b1110e70cd13bd8c53c329ede&client_secret=1cfe817fb9b4ed9dfffe48cd62c4a58385879eb445c42e3a61bbf4f33eb0f4bc&grant_type=authorization_code&code=f1dd6a64b8ac478275bf7f29830404c9a3fb79f29fc2f29e17637ebed1f8ac8d |
| $ brew install libmagic | |
| $ brew link libmagic (if the link is already created is going to fail, don't worry about that) | |
| $ env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/ |
| # see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version | |
| # see https://github.com/defunkt/resque/issues/49 | |
| # see http://redis.io/commands - new commands | |
| namespace :resque do | |
| desc "Clear pending tasks" | |
| task :clear => :environment do | |
| queues = Resque.queues | |
| queues.each do |queue_name| | |
| puts "Clearing #{queue_name}..." |