Skip to content

Instantly share code, notes, and snippets.

🕵
Investigating a better artifact workflow

Jake Morrison techthoughts2

🕵
Investigating a better artifact workflow
Block or report user

Report or block techthoughts2

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
View Microsoft.VSCode_profile
#Microsoft.VSCode_profile.ps1
Write-Host -ForegroundColor Gray ("Loading up the EditorServicesCommandSuite...")
try {
# Place this in your VSCode profile
Import-Module EditorServicesCommandSuite
Import-EditorCommand -Module EditorServicesCommandSuite
Write-Host "EditorServicesCommandSuite loaded." -ForegroundColor Magenta
}
catch{
Write-Host "Jake, EditorServicesCommandSuite has failed." -ForegroundColor DarkRed
View cfn_task
{
"version": "2.0.0",
"tasks": [
{
"label": "CF Resource List",
"type": "process",
"command": "chrome.exe",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
@techthoughts2
techthoughts2 / install_python
Last active Feb 10, 2019
Chocolatey install of python on windows
View install_python
#from admin console window
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install python
#now setup for cf-lint
python -m pip install --upgrade pip
pip install cfn-lint
View Get-FreeDriveLetter
function Get-FreeDriveLetter {
$regex = "[A-Z]:"
$netuseOutput = net use
$driveArray = @()
$providers = Get-PSDrive -PSProvider FileSystem
$psdriveDriveLetters = $providers.Name
$driveArray += $psdriveDriveLetters
$netuseDriveLetters = ($netuseOutput | Select-String -Pattern $regex).Matches.Value
$netuseDriveLetters = $netuseDriveLetters -replace ':', ""
$driveArray += $netuseDriveLetters
@techthoughts2
techthoughts2 / git_commands
Last active Jan 5, 2019
Collection of Git Commands
View git_commands
git clone https://repo_address.git
git add .
git add --all
git commit -m "Initial commit"
git push origin master
git pull origin master
git config user.name "Jake"
@techthoughts2
techthoughts2 / ps_suppress
Created Jan 3, 2019
Examples of PSScriptAnalyzer Suppressions
View ps_suppress
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "", Justification = "While it has start verb, it doesn't actually change the system state")]
@techthoughts2
techthoughts2 / ps_gpo
Last active Jan 3, 2019
PS GPO Stuff
View ps_gpo
#get RSOP from a server core device (can be run remotely)
Get-GPResultantSetOfPolicy -Computer Server1 -ReportType Html -Path C:\temp\Server1_SOP.html
@techthoughts2
techthoughts2 / PS_Redirects
Last active Jan 2, 2019
Various ways to handle redirects
View PS_Redirects
<#
try {
$a = Invoke-WebRequest -Uri $uri -MaximumRedirection 0 -ErrorAction Stop
}#try_Invoke-WebRequest
catch {
#if($_.ErrorDetails.Message -like "*maximum redirection*"){
if($_.Exception.Message -like "*Moved*"){
Write-Verbose -Message 'Moved detected.'
#$result = $a.Headers.Location
$result = $a.Exception.Response.Headers.Location.AbsoluteUri
View module_update_check
Get-InstalledModule | Select-Object Name, @{n='Installed';e={$_.Version}}, @{n='Available';e={(Find-Module -Name $_.Name).Version}} | Where-Object {$_.Available -gt $_.Installed}
View reset-lcm
################################################################################
# The "nice" way to reset the LCM...
if (-not(Test-Path -Path 'C:\Temp')) { $null = New-Item -Path 'C:\Temp' -ItemType 'Directory'}
[DscLocalConfigurationManager()]
Configuration ResetLCM {
Param (
[String[]]
$NodeName
)
Node $NodeName {
You can’t perform that action at this time.