Skip to content

Instantly share code, notes, and snippets.

Chris Nakagaki Zsoldier

Block or report user

Report or block Zsoldier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Zsoldier /
Created Jan 18, 2020
Basically a way for me to sync changes via dropbox and restore a MacOS terminal environment w/o bringing along all the garbage that Time Machine will likely haul with it.
overwrite=true #only applies to zsh profile, not implemented for other stuff. no overwrite by default elsewhere.
Zsoldier /
Last active Jan 17, 2020 — forked from lanefu/
Bulk Insert of active EdgeOS dhcp leases into /etc/hosts aka regenerate entries in /etc/hosts
## 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
for line in $(printf "$(cat /tmp/leases.txt|tail -n +3|awk '{print $6, $1, $2}')")
Zsoldier /
Last active Jan 17, 2020
Effectively, the script works like so: An existing sudoer/root/admin must run this script. You provide a username and the user's ssh public key. Set sudoer to true or false (or anything other than true really) customsudofile path defaults to /etc/sudoers.d/nopasswd Essentially, anything in sudoers.d path is ingested by sudoer file as an override…
tmpsudofile="/tmp/nopasswd" #used for safety check to assure sudo syntax is correct.
customsudodata="%sudo ALL=(ALL:ALL) NOPASSWD: ALL"
useradd $username
Zsoldier /
Last active Sep 27, 2019
Bash Function example calling several terminal windows in MacOS using AppleScript to launch sshuttle sessions.
#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.
echo -n Password:
read -s something
echo "Connecting to 1st Jumpbox and proxying IP through it."
osascript -e "tell app \"Terminal\"
do script \"sshuttle -r\"
delay 2
end tell"
Zsoldier / Get-AzureGlobalReachEnabledERCircuits.ps1
Last active Sep 27, 2019
Gather ExpressRoute Circuits with Global Reach enabled. This does account for multiple subscriptions as well.
View Get-AzureGlobalReachEnabledERCircuits.ps1
#Requires -Modules az
$ERGREnabled = @()
$GRDataFull = @()
$ERCircuits = @()
$Subs = Get-AzSubscription
Foreach ($Sub in $Subs){
Set-AzContext $Sub
$ERCircuits += Get-AzExpressRouteCircuit
Zsoldier / cloud-init.yaml
Created Sep 10, 2019 — forked from syntaqx/cloud-init.yaml
cloud init to install docker on ubuntu
View cloud-init.yaml
package_update: true
package_upgrade: true
package_reboot_if_required: true
manage-resolv-conf: true
- ''
Zsoldier / Get-SSLCert.ps1
Last active Nov 18, 2019
Allows you to pull down a remote systems SSL certificate regardless of whether it's trusted or not. This was made for Powershell Core, so should work on any platform than runs PS Core. No ServicePoint required. Specifically created to pull down and convert a vCenter's SSL Cert and convert to SHA256 thumbprint for registration to NSX-T.
View Get-SSLCert.ps1
Function Get-SSLCert{
Gets SSL certificate of remote system.
Gets SSL certificate of remote system in order to get it's thumbprint.
Returns the certificate as object.
Zsoldier / PowerShellRestEndPoint.ps1
Last active Aug 29, 2018
Expands upon the example that Kamal of posted on. Script is majority the same, but this example would let you define not only GETs, but POSTS and transform something like a json input into a PS Object to work against. Same caveats still apply related to security, but fascinating nonetheless.
View PowerShellRestEndPoint.ps1
# Reference:
# Create a listener on port 7000
$listener = New-Object System.Net.HttpListener
'Listening ...'
# Run until you send a GET request to /end
while ($true) {
$context = $listener.GetContext()
Zsoldier / Get-CDPorLLDPInfofromESXi.ps1
Last active May 14, 2018
Get-CDP or LLDP Info from ESXi/vCenter
View Get-CDPorLLDPInfofromESXi.ps1
function Get-CDPorLLDP {
$myCol = @()
foreach ($VIServer in $global:DefaultVIServers)
$vmhosts = Get-VMHost -Server $VIServer | where-object {$_.ConnectionState -eq "Connected" -or "Maintenance"}
foreach ($vmhost in $vmhosts)
Write-Host "Collating information for $($VMHost.Name)"
$networkSystem = Get-view -Server $viserver -Id $vmhost.extensiondata.ConfigManager.NetworkSystem
foreach($pnic in $networkSystem.NetworkConfig.Pnic)
View Get-NSXFirewallReport.ps1
<# Uncomment if you'd like to use. These are assumed and needed for custom report to work. Must be connected to vCenter and NSXMgr.
Import-Module vmware.powercli,powernsx
$Creds = Get-Credential -Message "Provide vCenter Admin credentials"
$vCenterNameorIP = Read-Host "Provide name or IP of vCenter"
Connect-VIServer $vCenterNameorIP -Credential $Creds
Connect-NSXServer -vCenterServer $vCenterNameorIP -Credential $Creds
$DFWRules = Get-NSXFirewallRule
$CustomReport = @()
You can’t perform that action at this time.