Skip to content

Instantly share code, notes, and snippets.

View dragosboca's full-sized avatar
coffee break

Dragos Boca dragosboca

coffee break
  • CloudSolutionsConsulting
  • Bucharest
  • 18:24 (UTC +02:00)
View GitHub Profile
#!/bin/bash
trap "echo interrupted && exit 2" INT TERM QUIT
limit=100
op=open
while getopts ":csw:" opt; do
case $opt in
require 'facter'
require 'aws-sdk'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
ec2 = Aws::EC2::Client.new(region:region)
instance = ec2.describe_instances(instance_ids:[instance_id])
tags = instance.reservations[0].instances[0].tags
tags.each do |tag|
#!/usr/bin/ruby
class Coins
def initialize(maxcoins, maxdepth=maxcoins, maxlen=maxcoins+2)
@maxcoins = maxcoins
@maxdepth = maxdepth
@maxlen = maxlen
@solution = nil
@coins = Array.new(@maxlen, ' ')