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
# Reference: http://hkeylocalmachine.com/?p=518 | |
# Create a listener on port 7000 | |
$listener = New-Object System.Net.HttpListener | |
$listener.Prefixes.Add('http://+:7000/') | |
$listener.Start() | |
'Listening ...' | |
# Run until you send a GET request to /end | |
while ($true) { | |
$context = $listener.GetContext() |
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
#cloud-config | |
package_update: true | |
package_upgrade: true | |
package_reboot_if_required: true | |
manage-resolv-conf: true | |
resolv_conf: | |
nameservers: | |
- '8.8.8.8' |
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
#First argument defines last IP octet for 2nd and 3rd commands. | |
#Second argument defines an additional subnet you want to proxy for the last sshuttle connection. | |
crazystuffhere(){ | |
echo -n Password: | |
read -s something | |
echo "Connecting to 1st Jumpbox 192.168.5.50 and proxying IP 192.168.10.50 through it." | |
osascript -e "tell app \"Terminal\" | |
do script \"sshuttle -r 192.168.5.50 192.168.10.50\" | |
delay 2 | |
end tell" |
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
username="" | |
sshpubkey="" | |
sudoer=true | |
allownopasswd=true | |
customsudodir="/etc/sudoers.d/" | |
tmpsudofile="/tmp/nopasswd" #used for safety check to assure sudo syntax is correct. | |
customsudodata="%sudo ALL=(ALL:ALL) NOPASSWD: ALL" | |
useradd $username |
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
## do this before hand | |
## vyatta will try to eval show under the wrong circumstances | |
show dhcp leases > /tmp/leases.txt | |
### dump below in a file, execute with bash | |
MY_INTERNAL_DOMAIN=local | |
IFS=$'\n' | |
for line in $(printf "$(cat /tmp/leases.txt|tail -n +3|awk '{print $6, $1, $2}')") | |
do |
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
overwrite=true #only applies to zsh profile, not implemented for other stuff. no overwrite by default elsewhere. | |
brew=true | |
SyncDir=~/Documents/_NakaProfile | |
customsudodir=/etc/sudoers.d/ | |
ZSHPlugins=$SyncDir/zsh/custom/plugins/ | |
ZSHThemes=$SyncDir/zsh/custom/themes/ | |
VPNConfigs=$SyncDir/vpn/ | |
stoken=$SyncDir/stoken | |
customsudofiles=$SyncDir/customsudo/ |
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
#Requires -Module PowerCLI,PowerNSX | |
$ESG = Get-NsxEdge -Name "BobLoblaw" | |
$ESGFW = $ESG | get-NSXEdgeFirewall | |
$ESGFWRules = Get-NSXEdgeFirewallRule -EdgeFirewall $ESGFW | |
$CustomReport = @() | |
$i = 1 | |
Foreach ($Rule in $ESGFWRules) | |
{ | |
$NewObject = "" | Select-Object RuleNo, RuleID, RuleName, Source, Destination, Description, ServicePorts, Action, appliedTo, datacentername |
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
# Grab VM object from HCX (Cannot be from vCenter) | |
$vm = Get-HCXVM -Name "NameofVM" | |
# If you have multiple sources or destination, you would need to augment with parameters such as name, server(hcxserver), and/or id. | |
$sourceSite = Get-HCXSite -Source | |
$targetSite = Get-HCXSite -Destination | |
# Source and target networks assume just one network adapter. | |
# For more than one adapter, you would need to loop through each source adapter and add to $NetworkMapping array. | |
$sourceNetwork = $vm.Network[0] |
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
$NSXMgr=”IPorDNSName” | |
$Credential = Get-Credential #Must be Enterprise Admin role. Typically “admin” | |
$skipcertcheck = $true | |
$AuthMethod = “Basic” | |
$TargetRouterName = “LeeroyJenkinsT1” | |
#To get target logical router id | |
$lrdata = Invoke-restmethod -Uri “https://$($NSXMgr)/api/v1/logical-routers” -Method GET -Credential $Credential -SkipCertificateCheck:$skipcertcheck -Authentication:$AuthMethod | |
$routerid = ($lrdata.results | Where-Object {$_.display_name -eq $TargetRouterName}).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
#Requires -Modules az | |
Connect-AzAccount | |
$ERGREnabled = @() | |
$GRDataFull = @() | |
$ERCircuits = @() | |
$Subs = Get-AzSubscription | |
Foreach ($Sub in $Subs){ | |
Select-AzSubscription $Sub | |
$ERCircuits += Get-AzExpressRouteCircuit | |
} |