- Build.
- Blog.
- Bresent.
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
| #!/bin/bash | |
| pkcs7=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/pkcs7 | paste -s -d '') | |
| result=$(curl -X POST "http://10.0.1.130:8200/v1/auth/aws-ec2/login" -d '{"role":"myapp","pkcs7":"'"$pkcs7"'","nonce":"vault-client-nonce"}') | |
| token=$( jq -r .auth.client_token <<< "$result" ) | |
| policies=$( jq -r .auth.policies[] <<< "$result" ) | |
| ami_id=$( jq -r .auth.metadata.ami_id <<< "$result" ) | |
| [[ -n $token ]] || exit 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
| def merge_sort(m) | |
| return m if m.length <= 1 | |
| middle = m.length / 2 | |
| left = m[0,middle] | |
| right = m[middle..-1] | |
| left = merge_sort(left) | |
| right = merge_sort(right) | |
| merge(left, right) |
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
| czxzxzxcxxxxx |
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
| jgk.hvulighkbvcjghvjhkjln.b,mhcfguihjl/m,m hcvgihjl |
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
| fdgfgfdggfgfdf |
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
| cazx cdd |
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 'sequel' | |
| require 'pry' | |
| DB = Sequel.postgres('chinook') | |
| class Artist < Sequel::Model | |
| end | |
| class Album < Sequel::Model | |
| end | |
| binding.pry |
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 'sequel' | |
| require 'pry' | |
| class Artist | |
| # CONN = PG.connect(dbname: 'chinook') | |
| DB = Sequel.postgres('chinook') | |
| attr_accessor *DB[:artists].columns | |
| def self.new_from_row(row) | |
| id = row[:id] |
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
| class Artist | |
| attr_reader :subscribers, :name, :label | |
| def initialize(name, label) | |
| @name = name | |
| @label = label | |
| @subscribers = [] | |
| end | |
| def add_subscriber(subscriber) |
NewerOlder