Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View natachaS's full-sized avatar
💭
Living life one PR at a time...

Natacha natachaS

💭
Living life one PR at a time...
View GitHub Profile
#!/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
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)

Interview Prep

General Thoughts for Interviewing

Three Primary Responsibilities

  • Build.
  • Blog.
  • Bresent.

Problem Solving

"Make it work, make it right, make it fast."

jgk.hvulighkbvcjghvjhkjln.b,mhcfguihjl/m,m hcvgihjl
require 'sequel'
require 'pry'
DB = Sequel.postgres('chinook')
class Artist < Sequel::Model
end
class Album < Sequel::Model
end
binding.pry
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]
class Artist
attr_reader :subscribers, :name, :label
def initialize(name, label)
@name = name
@label = label
@subscribers = []
end
def add_subscriber(subscriber)