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 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 {
@techthoughts2
techthoughts2 / schedule_cron
Last active Dec 2, 2018
Scheduled cron expressions and examples of using cron to scheudle things in AWS
View schedule_cron
cron(Minutes | Hours | Day-of-month | Month | Day-of-week | Year)
cron(0 0/4 * * ? *) Every 4 hours
cron(0 10 * * ? *) 10:00AM UTC everyday
cron(15 12 * * ? *) 12:15PM UTC everyday
cron(0 18 ? * MON-FRI *) 6:00PM UTC every Mon-Fri
cron(0 8 1 * ? *) 8:00AM UTC every first day of the month
cron(0/10 * ? * MON-FRI *) Every 10 min Mon-Fri
cron(0/5 8-17 ? * MON-FRI *)Every 5 minutes Mon-Fri between 8:00AM - 5:55PM UTC
cron(0 9 ? * 2#1 *) 9:00AM UTC first Monday of each month
You can’t perform that action at this time.