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
| require 'json' | |
| require 'csv' | |
| data = File.open("occupation.csv").read | |
| a = CSV.parse(data).to_json | |
| b = JSON.parse a | |
| c = b.to_h |
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
| ### 1. create your keys | |
| ### 2. add keys to .ssh/config | |
| ##~/.ssh/config | |
| #user1 account | |
| Host bitbucket-user1 | |
| HostName bitbucket.org | |
| User git | |
| IdentityFile ~/.ssh/user1_rsa | |
| IdentitiesOnly yes |
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
| require 'fog/aws' | |
| con = Fog::Storage.new( | |
| provider: 'AWS', | |
| aws_secret_access_key: ENV["AWS_KEY"], | |
| region: ENV["AWS_REGION"], | |
| aws_access_key_id: ENV["AWS_ID"], | |
| connection_options: { region: EVN["AWS_REGION"] } | |
| ) | |
| ## Fog::AWS::Storage object |
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
| #pass in arguments as symbol | |
| task :first_task, [:first, :second] do |t, args| | |
| puts args[:first] | |
| puts args[:second] | |
| end | |
| #pass in arguments for dependencies | |
| task :main_task, [:first, :second] => :first_task do |t, args| | |
| puts 'main task' | |
| end |
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
| #add prerequisites | |
| task :prereq_1 do | |
| #always halt tasks | |
| raise if false | |
| end | |
| #extend task to include prerequisite | |
| Rake::Task['db:setup'].enhance [:prereq_1] | |
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
| brew install jsonpp | |
| curl -XGET "http:/localhost:9200/user/_mapping/admin" | jsonpp |
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
| #/config/deploy.rb | |
| #use current branch: | |
| # cap my_app:staging deploy | |
| #specify a branch: | |
| # cap my_app:staging deploy BRANCH=not-current-branch | |
| set :current_branch, `git rev-parse --abbrev-ref HEAD`.strip | |
| set :branch, ENV['BRANCH'] || fetch(:current_branch) |
NewerOlder