Skip to content

Instantly share code, notes, and snippets.

@Braytiner
Braytiner / Windows Defender Exclusions VS 2022.ps1
Last active June 21, 2024 13:29
Adds Windows Defender exclusions for Visual Studio 2022
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\Downloads\HeidiSQL_11.3_64_Portable') > $null
$pathExclusions.Add($userPath + '\.dotnet') > $null
@Albert221
Albert221 / ToggleEthernet.ps1
Created April 15, 2020 01:06
PowerShell script to toggle (enable/disable) Ethernet net adapter
# Run as administrator - https://stackoverflow.com/a/57035712/3158312
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
exit;
}
$adapterName = 'Ethernet'
$status = Get-NetAdapter -Name $adapterName | Format-List -Property "Status" | Out-String
@onyxhat
onyxhat / get_myip.php
Created March 10, 2019 04:59
simple PHP script to return client IP address
<?php
/**
* Ensures an ip address is both a valid IP and does not fall within
* a private network range.
*/
function validate_ip($ip) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) {
return false;
}
return true;