Skip to content

Instantly share code, notes, and snippets.

View 1RedOne's full-sized avatar

Stephen Owen 1RedOne

View GitHub Profile
@1RedOne
1RedOne / Recovery.md
Created April 22, 2025 16:46
Recovering from an outage

Recovering from nuking production

If you've read about that time I destroyed Active Directory with a PowerShell script which saved me two minutes of work and took down all of prod (even locking people out of the parking deck and disabling internet access!) then you might wonder how I kept my job.

There are a few things I did to survive the experience.

  • Take my lumps and own up
  • Show up and participate in recovery
  • Document it and write the Post Incident Report
  • Learn from it
@1RedOne
1RedOne / caution.md
Last active April 22, 2025 16:56
That time I destroyed Active Directory

Premature Optimization

Maybe once a month I would get a request to make a new user in a department. The format was always "make user A just like user B with all of the same groups she has".

I was just learning PowerShell and hated having to do this by hand and also not have any trail of my work. So I wrote a nice script that made UserB a member of all of UserA's groups, with some nice logging and tested it over and over in -What If mode.

Eventually I get a new ticket request and tell my coworker, "hey, check This out!" And run the script and it outputs

PS>Now copying all groups from user A
 
@1RedOne
1RedOne / Readme.md
Created May 1, 2024 19:18
Mining Safety

Surviving in mines


Resources

Interesting stuff - 56 The ways out of the mine should already be clearly marked to meet the requirements of regulation 3 of The Mines (Safety of Exit) Regulations 1988.

@1RedOne
1RedOne / game.js
Created November 9, 2023 15:37
Basic Ball Bouncing on Grid example in phaser 3
function preload() {
this.load.image('ball', 'bullet.png');
this.load.image('tile', 'turret.jpeg');
}
function addBall(physics, tilesGroup, x, y, color) {
var ball1 = physics.add.sprite(x, y, 'ball');
ball1
.setScale(0.1)
.setBounce(1)
@1RedOne
1RedOne / setIcon.sh
Created March 3, 2023 15:49
Good work around to have Windows style Profile icons for the Edge Browser
# prereq, install Edge and ALSO Edge Dev
# in Edge, sign in with your normal profile
# in Edge Dev, sign in with your work profile
# then download the thumbnail / profile icon you want for both
# finally, install fileIcon
#to run as a cronJob (like a Windows scheduled task)
# run 'sudo crontab -e'
# add this line to the top
# 45 * * * * /Library/temp/setIcons.sh >> /Users/Stephen/iconSetLog.log
@1RedOne
1RedOne / CreateVm.cs
Created January 18, 2023 14:28
Azure.ResourceManager Create VM with new nic example.cs
using Azure;
using Azure.Core;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
namespace AutoManageTest
scary, fear, fnaf, freddies, huggy wuggy, cursed thomas, choo choo charles, darwin awards, Trollface Quest: Horror, FNaF: Sister Location Custom Night, MOMO, Escape from Ayuwoki, The Secret of the Necromancer, Five Nights at Freddy's, Slenderman Must Die: Silent Streets,jumpscare
@1RedOne
1RedOne / Update-SubLibVm.ps1
Created April 19, 2022 13:58
A script to update sublib VMs
Import-Module Az.Accounts
Import-Module Az.Automation
Import-Module Az.Compute
<#
.DESCRIPTION
A runbook to iterate through VMs in this Sublib and tell them to patch, if they don't have a 'DontPatch' tag
.NOTES
AUTHOR: Stephen Owen
@1RedOne
1RedOne / Get-OfficeFileInfo.ps1
Created July 21, 2021 15:48
Get Office File Info In PowerShell
#https://stackoverflow.com/questions/34336486/get-file-last-saved-by-property-without-changing-it
function Get-OfficeFileInfo($filePath){
if ($filePath -like "*.doc*"){
Get-WordFileInfo $filePath
}
else{
Get-ExcelFileInfo $filePath
}
}
@1RedOne
1RedOne / ConvertTo-StringData.ps1
Last active June 30, 2021 18:25
ConvertTo-StringData - Converting a complex object into StringData
Function ConvertTo-StringData($object, $propertyOverride){
$fields = $object | get-member -MemberType NoteProperty
foreach($field in $fields){
if (IsArray($field)){
OutputArrayMember -object $object -field $field
}
else{
OutputMember -object $object -propertyName $field.name -propertyOverride $propertyOverride
}