This file contains 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
tell application "Safari" | |
set reloadQuestion to display dialog "Reload each tab?" buttons {"Yes", "No"} default button 2 | |
set reloadAnswer to button returned of reloadQuestion | |
if reloadAnswer is equal to "Yes" then | |
set reloadTab to true | |
else | |
set reloadTab to false | |
end if | |
(choose from list {1, 5, 10, 30, 60} ¬ | |
with prompt "Select delay time in seconds?" default items 30) |
This file contains 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
Thu Dec 15 14:41:41 UTC 2016 |
This file contains 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
# Security groups that contain 0.0.0.0/0 rules | |
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0 --output=text | grep SECURITYGROUPS | |
# Security groups for ElasticSearch | |
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=9200 --output=text | grep SECURITYGROUPS | |
# Search last 10,000/1MB of CloudTrail logs for 'AccessDenied' (removed AWS account number from stream name) | |
aws logs get-log-events --log-group-name CloudTrail/DefaultLogGroup --log-stream-name 000000000000_CloudTrail_eu-west-1 | grep AccessDenied | |
# Get number of AWS API calls in time period (assumes a Cloudwatch Logs 'catch-all' filter and metric has been created against CloudTrail logs) |
This file contains 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
echo "hello world" | |
ls -la |
This file contains 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
# Pretty much copied from Rightscale examples at | |
# http://support.rightscale.com/12-Guides/RightScale_API_1.5/Examples/ | |
# Update and revision test | |
require 'rubygems' | |
require 'pp' # Require pretty print Ruby gem | |
require 'right_api_client' # RightScale API client gem | |
user = '[email protected]' # Set user email address for using the Dashboard | |
acct = '1234' # Set the account ID |
This file contains 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
$subnet24 = "10.10.1" | |
1..254 | | |
foreach-object { | |
$ip = $subnet24 + "." + $_ | |
if (test-connection $ip -count 1 -quiet) { Write-Host "USED:$ip" } else { Write-Host "EMPT:$ip" } | |
} | |
#USED:10.10.2.1 | |
#EMPT:10.10.2.2 |
This file contains 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 'rubygems' | |
require 'pp' | |
require 'fog' | |
require 'highline/import' | |
def get_password(prompt="Enter password:") | |
ask(prompt) {|q| q.echo = false} | |
end |
This file contains 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
Function Get-OSTypeFromTemplate { | |
param($templatename) | |
$templateview=get-view -id (get-template -Name $templatename).id | |
switch -wildcard ($templateview.Guest.GuestFullName) | |
{ | |
"*Windows*" { $ostype = "Windows" } | |
"*Linux*" { $ostype = "Linux" } | |
default { $ostype = Read-Host "Unable to determine OS from template $templatename. Enter the word Linux or Windows here" } | |
} |
This file contains 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
Function Get-GatewayFromIPAddress { | |
param($ipaddress) | |
$routerip = ".1" | |
$gateway = (($ipaddress.Split("."))[0..2] -join ".") + $routerip | |
return $gateway | |
} | |
$ipaddress = "10.1.2.100" | |
$gateway = Get-GatewayFromIPAddress -ipaddress $ipaddress |
This file contains 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
Function Get-DomainFromFQDN { | |
param($fqdn) | |
$vmdomain = ($fqdn.split("."))[1..4] | |
$vmdomain = $vmdomain -join "." | |
return $vmdomain | |
} | |
$fqdn = "myhost.my.domain.local" | |
$domain = Get-DomainFromFQDN -fqdn $fqdn |