Skip to content

Instantly share code, notes, and snippets.

@MrChrisWeinert
MrChrisWeinert / Excel Date Format for SQL datetime
Last active July 6, 2023 20:52
This is the Excel Date Format to use that will properly display SQL server's datetime data type.
yyyy-mm-dd hh:mm:ss.000
or
dd-mmm-yy hh:mm AM/PM
'Emergency script created for a friend to toggle HDR
Set oShell = CreateObject("WScript.Shell")
oShell.Run("""ms-settings:display""")
WScript.Sleep 2000
oShell.AppActivate "settings"
WScript.Sleep 100
oShell.SendKeys "{TAB}"
WScript.Sleep 100
oShell.SendKeys "{TAB}"
WScript.Sleep 100
#Create the list of base images to select from
$Ubuntu = New-Object System.Management.Automation.Host.ChoiceDescription '&Ubuntu', 'OS: Ubuntu 20.04.3 Desktop'
$Win10 = New-Object System.Management.Automation.Host.ChoiceDescription 'Win1&0', 'OS: Windows 10'
$Win11 = New-Object System.Management.Automation.Host.ChoiceDescription 'Win1&1', 'OS: Windows 11 Updated January 2022'
$Server = New-Object System.Management.Automation.Host.ChoiceDescription '&Server', 'OS: Windows Server 2022 Updated January 2022'
$options = [System.Management.Automation.Host.ChoiceDescription[]]($Ubuntu, $Win10, $Win11, $Server)
$VMName = Read-Host("Please enter your VM Name")
$OS = $Host.UI.PromptForChoice("","Please select an Operating System",$options, 0)
@MrChrisWeinert
MrChrisWeinert / triage.bat
Last active January 24, 2023 16:49
Windows triage
tasklist > info.txt && arp -a >> info.txt && netstat -ano >> info.txt && sc query >> info.txt && systeminfo >> info.txt
@MrChrisWeinert
MrChrisWeinert / WhatVersionOfOperatingSystemIsRunning.sh
Created December 9, 2021 20:29
Shows what version of Linux is running
#!/bin/zsh
grep VERSION /etc/os-release
uname -v
uname -r
<!ENTITY all '%start;%goodies;%end;'>
@MrChrisWeinert
MrChrisWeinert / GameOfLife.cs
Created August 4, 2020 15:00 — forked from lennartb-/GameOfLife.cs
Conway's Game of Life in C# (Console App) with basic arrays and without any fancy complicated stuff. No error checking included.
using System;
namespace GameOfLife {
public class LifeSimulation {
private int Heigth;
private int Width;
private bool[,] cells;
/// <summary>
@MrChrisWeinert
MrChrisWeinert / MigrateBitbucketToAzureDevOps
Created July 29, 2020 16:22
Use this code to clone an existing Bitbucket repo into a temporary folder and push it to Azure DevOps
mkdir Codeios
cd Codeios/
git clone --bare http://chrisweinert@bitbucket.servername.com:1234/scm/somename/ios.git
cd ios.git/
git lfs fetch --all
git push --mirror https://companyname@dev.azure.com/companyname/Mobile/_git/ios
@MrChrisWeinert
MrChrisWeinert / mysql.txt
Created June 15, 2020 20:13
Generic mysql permission stuff (mostly for Wordpress)
connect:
sudo mysql --user=root
Show users and where they can connect from:
SELECT user,host FROM mysql.user;
Show user-specific privileges:
SHOW GRANTS FOR 'user'@'192.168.x.xx';
Update user privileges:
Enable-PSRemoting
Get-Item WSMan:\localhost\Client\TrustedHosts
Set-Item WSMan:\localhost\Client\TrustedHosts -Value 'RemoteServerName'
#This weird thing is only needed if you still can't run WSMan commands even after enabling all the trust settings (https://web.archive.org/web/20110615172805/http://www.shirmanov.com/2011/04/winrm-access-is-denied-on-local.html)
#("Enable-PSRemoting" should do it for you, this just manually does it)
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
#Load up a server list
[string[]]$ServerList = Get-Content C:\ALL-WEB-NORTHCENTRAL.lst