Skip to content

Instantly share code, notes, and snippets.

View Tiberriver256's full-sized avatar
📚
Still learning

Micah Rairdon Tiberriver256

📚
Still learning
View GitHub Profile
<#
.SYNOPSIS
Copy files using your clipboard and PowerShell
.DESCRIPTION
The file specified at $Path is converted to a base64 string, wrapped with a tiny script that converts the base64 string
back to binary and saves it at the path specified in the $Destination parameter
#>
function Copy-PasteItem {
[CmdletBinding()]
@Tiberriver256
Tiberriver256 / index.html
Last active January 9, 2020 19:21
scrollable-menu
<html>
<body>
<table style="width: 100%; overflow-x: hidden; table-layout: fixed;">
<tbody>
<tr>
<td style="text-align: center; width: 200px; border-right: solid;">
<h1>Product</h1>
<img src="https://media.haworth.com/image/117471/s800/fern_linkedin_50x50_1-(1).jpg" style="max-height: 100px;" />
</td>
<td style="padding-left: 20px">
## Git
cinst -y git.install
cinst -y poshgit
cinst -y Git-Credential-Manager-for-Windows
cinst -y visualstudiocode
@Tiberriver256
Tiberriver256 / FindPortProcessName.ps1
Created March 12, 2019 14:33
Gets the process name and PID for a given port
$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 March 12, 2019 14:32
Find what process is using a port on Windows
$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 October 3, 2024 23:30
My Ubuntu development environment setup script
#!/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 January 5, 2024 08:25
My personal development environment configuration
# Configure Windows
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Update-ExecutionPolicy Unrestricted
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name Get-ChildItemColor,posh-git,terminal-icons -Force
## Git
winget install -e --accept-source-agreements --silent --accept-package-agreements --id Git.Git
@Tiberriver256
Tiberriver256 / Set-Transparency.ps1
Last active March 6, 2024 03:49
Make any window transparent using PowerShell. Modified from https://gist.github.com/grenade/ed8dd77ae8eeb5b4a3c1cfd66e9c8ae7
$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 March 2, 2023 00:24
Trying to get Kestrel working in PowerShell...
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 January 14, 2024 07:04
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…
$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
}