Skip to content

Instantly share code, notes, and snippets.

View mikebranstein's full-sized avatar

Mike Branstein mikebranstein

View GitHub Profile
@mikebranstein
mikebranstein / add-multiple-devices-to-trusted-hosts.ps1
Created August 24, 2016 17:32
Add multiple devices to the Trusted Hosts file.
$trustedHosts = Get-Item WSMan:\localhost\Client\TrustedHosts
if ($trustedHosts.Value -eq "") {
Set-Item WSMan:\localhost\Client\TrustedHosts -Value $ipAddress -Force
}
elseif (-not $trustedHosts.Value.Contains($ipAddress)) {
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "$($trustedHosts.Value),$($ipAddress)" -Force
}
@mikebranstein
mikebranstein / add-device-to-trusted-hosts.ps1
Created August 24, 2016 17:29
Add a device to the trusted hosts file
Set-Item WSMan:\localhost\Client\TrustedHosts -Value $ipAddress -Force
$baseUrl = "http://assets.pokemon.com/assets/cms2/img/pokedex/full/"
New-Item .\pokedex -type directory
for ($i = 1; $i -lt 721; $i++) {
$fileName = $i.ToString("000") + ".png"
$url = $baseUrl + $fileName
$output = "pokedex\" + $fileName
Write-Host $fileName
public HandRank GetHandRank() =>
IsRoyalFlush() ? HandRank.RoyalFlush :
IsStraightFlush() ? HandRank.StraightFlush :
IsFourOfAKind() ? HandRank.FourOfAKind :
IsFullHouse() ? HandRank.FullHouse :
IsFlush() ? HandRank.Flush :
IsStraight() ? HandRank.Straight :
IsThreeOfAKind() ? HandRank.ThreeOfAKind :
IsTwoPair() ? HandRank.TwoPair :
IsPair() ? HandRank.Pair :
@mikebranstein
mikebranstein / arp-to-ip-lookup-powershell.ps1
Created July 27, 2016 13:56
ARP to IP lookup PowerShell script
# Gets the IP address of a computer via the MAC address. This will only work on LAN
# segments. By default we'll scan the ARP table, but then defer to an IP scan to
# as needed.
#
# Usage: $returnIpAddress = GetIPFromMAC "12-43-de-52-a9-99" "192.168.10."
# Pass in the mac address with dashes (-) as the first parameter
# Pass in an IP address with the last number missing, be sure to include the trailing "."
# Be sure to check the value if $returnIpAddress -eq $null to see if a value was actually returned
#
function GetIPFromMAC {
@mikebranstein
mikebranstein / ping-network-to-resolve-arp.ps1
Last active February 23, 2024 15:10
PowerShell script to hydrate ARP table via subnet pings
for ($i = 1; $i -lt 255; $i++) {
ping "$networkSegment$i" -n 1 -l 1 -4 -w 500 | Out-Null
$ip = arp -a "$networkSegment$i" | Select-String $macAddress |% { $_.ToString().Trim().Split(" ")[0] }
if ($ip -ne $null) {
Write-Host "Found $macAddress during deep scan, IP: $ip"
break
}
}
@mikebranstein
mikebranstein / arp-lookup-ip.ps1
Last active July 7, 2021 16:45
Lookup IP address via ARP command on Windows
$ip = arp -a "$IPAddress" | Select-String $macAddress |% { $_.ToString().Trim().Split(" ")[0] }
@mikebranstein
mikebranstein / nativescript-myrobot-button
Created March 27, 2016 12:31
XML markup for the profile image button in the My Robot NativeScript app
<Button id="mike" row="1" col="1" tap="{{ onTap }}" />
@mikebranstein
mikebranstein / myrobot-button-css
Created March 27, 2016 12:30
CSS for the buttons backed by an image in the My Robot NativeScript app
Button {
background-repeat: no-repeat;
background-size: 340px 340px;
background-position: left top;
width: 340px;
height: 340px;
}
#mike {
background-image: url("res://mike");
}
@mikebranstein
mikebranstein / hangfire-auto-deployment-netsh
Created February 14, 2016 19:52
Netsh commands added to my hangfire auto deployment powershell scripts
Param
(
[string] $userName
)
netsh http add urlacl url=http://127.0.0.1:9095/ user=$userName
netsh http add urlacl url=http://localhost:9095/ user=$userName
netsh http add urlacl url=http://$env:computername`:9095/ user=$userName