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 | |
| USER=$1 | |
| HOST=$2 | |
| function test_ssh_key_setup() { | |
| ssh -q -q -o "BatchMode=yes" -o "ConnectTimeout 5" ${USER}@${HOST} "echo 2>1" | |
| [ $? ] && return 0 || return 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
| #!/bin/bash | |
| function ask_multi_choice() { | |
| local QUESTION=$1 | |
| while [ -z "$CHOICE" ]; do | |
| echo | |
| for S in ${!POSSIBLE_ANSWERS[*]}; do | |
| echo " ${S}) ${POSSIBLE_ANSWERS[$S]}" | |
| done |
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
| #!/usr/bin/env ruby | |
| module SomeLibrary | |
| def something | |
| puts "Weee" | |
| end | |
| module_function :something | |
| 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
| INFO global: Vagrant version: 1.5.0 | |
| INFO global: Ruby version: 2.0.0 | |
| INFO global: RubyGems version: 2.0.14 | |
| INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.0/bin/vagrant" | |
| INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/bin/../embedded" | |
| INFO global: VAGRANT_INSTALLER_VERSION="2" | |
| INFO global: VAGRANT_DETECTED_OS="Linux" | |
| INFO global: VAGRANT_INSTALLER_ENV="1" | |
| INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1" | |
| INFO global: VAGRANT_LOG="debug" |
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 | |
| SMTP_SERVER='mail.example.tld' | |
| EMAIL_FROM="$(whoami)@$(hostname)" | |
| EMAIL_DESTINATION='[email protected]' | |
| cat << EOM | nc -C ${SMTP_SERVER} 25 | |
| EHLO $(hostname) | |
| MAIL FROM: ${EMAIL_FROM} | |
| RCPT TO: ${EMAIL_DESTINATION} |
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 'openssl' | |
| # The key for the sample: | |
| private_key = OpenSSL::PKey::RSA.new(1024) | |
| # This method is for comparing an RSA key too an SSH server when it's using | |
| # MD5. You can pass either a public or private key here. | |
| def ssh_md5_fingerprint(key) | |
| OpenSSL::Digest::MD5.hexdigest( | |
| [7].pack("N") + 'ssh-rsa' + key.public_key.e.to_s(0) + key.public_key.n.to_s(0) |
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 Worker | |
| attr_reader :id | |
| def initialize(id) | |
| @id = id | |
| puts "Spawned new worker with id: #{id}" | |
| end | |
| def dead? | |
| return true if @killed |
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 'singleton' | |
| CHANGE_VALUES = [1, 5, 10, 25, 50, 100].reverse | |
| TARGET_VALUE = 100 | |
| class ReportTiming | |
| include Singleton | |
| def initialize | |
| reported |
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
| #!/usr/bin/env ruby | |
| @crashes = 0 | |
| def exception_test(state) | |
| puts "Main block: #{state}" | |
| # Modify our 'state' | |
| state += 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
| #!/usr/bin/env ruby | |
| require 'ipaddr' | |
| # Hosts that we're already aware of by IP | |
| known_hosts = %w{ 127.0.0.1 192.168.122.5 192.168.122.20 192.168.122.48 | |
| 192.168.122.134 192.168.122.200 192.168.122.210 192.168.122.230 } | |
| # A new task has completed with the following target (only covers | |
| # 192.168.122.0-192.168.122.127) |