Skip to content

Instantly share code, notes, and snippets.

Micah Rairdon Tiberriver256

Block or report user

Report or block Tiberriver256

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
@Tiberriver256
Tiberriver256 / FindPortProcessName.ps1
Created Mar 12, 2019
Gets the process name and PID for a given port
View FindPortProcessName.ps1
$Port = "8080"
netstat -a -n -o | where { $_ -match $Port } | foreach {
$Process = Get-Process -PID (($_ -replace "\s+"," ") -split " ")[-1]
"Process: $($Process.ProcessName) ($($Process.Id)) is using $Port"
}
@Tiberriver256
Tiberriver256 / FindPortProcessName
Created Mar 12, 2019
Find what process is using a port on Windows
View FindPortProcessName
$Port = "8080"
netstat -a -n -o | where { $_ -match $Port } | foreach {
$Process = Get-Process -PID (($_ -replace "\s+"," ") -split " ")[-1]
"Process: $($Process.ProcessName) ($($Process.Id)) is using $Port"
}
@Tiberriver256
Tiberriver256 / setup.ps1
Last active Nov 22, 2018
My Ubuntu development environment setup script
View setup.ps1
#!/bin/pwsh
Install-Module -Name Get-ChildItemColor, oh-my-posh, posh-git, nvm -Force
md ~\.config\powershell
"Set-Theme -name Darkblood" | Out-File $Profile -Append
Install-NodeVersion 8
Install-NodeVersion 10
@Tiberriver256
Tiberriver256 / boxstarter
Last active Mar 6, 2019
My personal development environment configuration
View boxstarter
# Configure Windows
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Update-ExecutionPolicy Unrestricted
cinst -y Microsoft-Hyper-V-All -source windowsFeatures
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name Get-ChildItemColor, oh-my-posh -Force
View Set-Transparency.ps1
$user32 = Add-Type -Name 'user32' -Namespace 'Win32' -PassThru -MemberDefinition @'
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint crKey, int bAlpha, uint dwFlags);
@Tiberriver256
Tiberriver256 / APlayingAroundWithKestrel.ps1
Last active Apr 24, 2018
Trying to get Kestrel working in PowerShell...
View APlayingAroundWithKestrel.ps1
using namespace Microsoft.AspNetCore.Builder;
using namespace Microsoft.AspNetCore.Http;
using namespace System;
using namespace Microsoft.AspNetCore.Hosting;
# If you don't have Visual Studio Installed this should work fine
# Install-Package Microsoft.AspNetCore -Source nuget.org -Destination .\.nuget\packages
# Install-Package Microsoft.AspNetCore.Server.Kestrel -Source nuget.org -Destination .\.nuget\packages
$LibFolder = ""
@Tiberriver256
Tiberriver256 / lilPowerShellNotepadSearcher.ps1
Last active Jan 12, 2018
This is a tiny little PowerShell script that will find any files you have open in Notepad and present them in out-gridview with lines to help with searching. Large files it will prompt you for a pre-search term or a regex to make it usable in out-gridview. Super handy for when you get logs in Outlook and don't want to save them to somewhere spec…
View lilPowerShellNotepadSearcher.ps1
$FilePaths = @()
$FilePaths = (Get-WmiObject win32_process -filter "name like 'notepad.exe'") |
foreach { ($_.commandline -split " ",2)[1] }
if($FilePaths.count -gt 1) {
$FilePath = $FilePaths | Out-GridView -PassThru -Title "Select the open file you would like to search"
} else {
$FilePath = $FilePaths
}
@Tiberriver256
Tiberriver256 / PowerShellNTFSStaticFileServer.ps1
Last active Aug 8, 2018
This script starts a small web server listening on localhost:8080 that will impersonate the authenticated user and serve static content. This means if they do not have NTFS permissions to the file they will get an access denied or a 404 file not found if they do not have NTFS access to list contents of the directory.
View PowerShellNTFSStaticFileServer.ps1
function Get-DirectoryContent {
<#
.SYNOPSIS
Function to get directory content
.EXAMPLE
Get-DirectoryContent -Path "C:\" -HeaderName "poshserver.net" -RequestURL "http://poshserver.net" -SubfolderName "/"
@Tiberriver256
Tiberriver256 / LicenseSKUToNameMappingHash.ps1
Last active Jun 2, 2017
LicenseSKUToNameMapping HashTable
View LicenseSKUToNameMappingHash.ps1
$LicenseSKUToNameMapping = @{
'EXCHANGE_S_ENTERPRISE' = 'Exchange Online (Plan 2)'
'CRMPLAN2' = 'Dynamics CRM Online Plan 2'
'POWER_BI_PRO' = 'Power BI Pro'
'DESKLESS' = 'Microsoft StaffHub'
'ATP_ENTERPRISE' = 'Exchange Online Advanced Threat Protection'
'EMS' = 'Enterprise Mobility Suite'
'POWER_BI_ADDON' = 'Power BI for Office 365 Add-On'
'ENTERPRISEPACK' = 'Office 365 Enterprise E3'
'ENTERPRISEWITHSCAL' = 'Office 365 Enterprise E4'
View PSWebServer.psm1
Function New-PSWebServer {
<#
.Synopsis
Creates a web server that will invoke PowerShell code based on routes being asked for by the client.
.Description
New-PSWebServer creates a web server. The web server is composed of a schema that defines the client's requests to routes where PowerShell code is executed.
Under the covers, New-PSWebServer uses the HTTPListener .NET class to execute powershell code as requested, retrieves the results and sends data back through the httplistener web server framework.
You can’t perform that action at this time.