Skip to content

Instantly share code, notes, and snippets.

View Chirishman's full-sized avatar
⚔️
I guess statuses are a thing now

Chirishman

⚔️
I guess statuses are a thing now
View GitHub Profile
@Chirishman
Chirishman / index.html
Last active August 30, 2018 22:53 — forked from apcj/index.html
Radial Node-Link Tree in D3
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Node-Link Tree (Radial)</title>
<script type="text/javascript" src="https://github.com/d3/d3/raw/2c030290457a4eac0efe34b1c7a61a29997ac3ef/d3.js"></script>
<script type="text/javascript" src="https://github.com/d3/d3/raw/2c030290457a4eac0efe34b1c7a61a29997ac3ef/d3.layout.js"></script>
<style type="text/css">
circle.node {
@Chirishman
Chirishman / ScheduleGoogleDNSUpdate.ps1
Last active May 1, 2019 01:32
Google Domains Dynamic DNS Updater
$ScheduledJob = @{
Name = 'DNS Updater'
Trigger = New-JobTrigger -Once -RepetitionInterval 0:15 -RepeatIndefinitely -At 10:30
Credential = (Get-Credential)
ScriptBlock = {
#Your info goes here
$hostname = "HOSTNAME.com"
$CurrentRecord = Resolve-DNSName -Name $hostname -Type A -Server 8.8.8.8 -DnsOnly | select -exp IPAddress
@Chirishman
Chirishman / MakeWinPEMedia.cmd
Last active September 25, 2023 20:48
MakeWinPEMedia - Replacement for Existing w/ PowerShell
@echo off
setlocal
rem
rem Set variables for local use
rem
set TEMPL=media
set FWFILES=fwfiles
set DISKPARTSCRIPT=%TMP%\UFDFormatDiskpartScript.txt
set EXITCODE=0
@Chirishman
Chirishman / DandISetEnv.bat
Created August 2, 2018 02:50
Windows Assessment and Deployment Kit - Deployment and Imaging Tools Environment Setup
@Echo off
REM
REM Sets the PROCESSOR_ARCHITECTURE according to native platform for x86 and x64.
REM
IF /I %PROCESSOR_ARCHITECTURE%==x86 (
IF NOT "%PROCESSOR_ARCHITEW6432%"=="" (
SET PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITEW6432%
)
) ELSE IF /I NOT %PROCESSOR_ARCHITECTURE%==amd64 (
@Chirishman
Chirishman / ValidateComputername.ps1
Last active July 25, 2018 19:30
ComputerName Validation
class ValidateComputernameAttribute : System.Management.Automation.ValidateArgumentsAttribute {
[void] Validate([object]$arguments, [System.Management.Automation.EngineIntrinsics]$engineIntrinsics) {
$ComputerName = $arguments
$FilterPattern = '\\|/|:|\*|\?|"|<|>|\|'
$MaxLength = 15
$Length = $ComputerName.Length
if([string]::IsNullOrWhiteSpace($ComputerName)) {
Throw [System.ArgumentNullException]::new()
} elseif ($Length -gt $MaxLength){
throw [System.Exception]::new("The character length of the argument ($Length) is too long. Shorten the character length of the argument so it is fewer than or equal to $MaxLength characters, and then try the command again.")
@Chirishman
Chirishman / Disable-CompanyUser.ps1
Created July 17, 2018 22:19
Disable-CompanyUser
Function Disable-CompanyUser {
[CmdletBinding(SupportsShouldProcess=$true)]
Param()
DynamicParam {
New-DynamicParams -count (($PSBoundParameters.GetEnumerator() | Measure-Object).Count - 1) -settings @(
($true | Select-Object @{
N="Name"
E={"User"}
},@{
N="SetScript"
@Chirishman
Chirishman / ISP_2.ps1
Last active July 17, 2018 19:21
Iron Scripter Prequel II
$ComputerInfo = @(
@{
Class = 'Win32_OperatingSystem'
Select = @(
@{
N='OS Name'
E={($_.Name -split '\|') | select -first 1}
},
@{
N='Version'
@Chirishman
Chirishman / OptimizeVHDX.ps1
Created June 20, 2018 18:20
Defrag and shrink expanding VHDX files
if (-not((clist -lo) -match 'Defraggler')) {
choco install defraggler -y
}
$VerbosePreference = 'Continue'
cd 'C:\Program Files\Defraggler\'
# Start with the VHDs mounted, online and read/write so that you know their drive letters
$Disks = @(
@Chirishman
Chirishman / Get-DirectoryServicesComputer.ps1
Last active June 18, 2018 17:30
Query computers and store in SQL
function Get-DirectoryServicesComputer {
[cmdletbinding()]
Param(
[switch]$ShowPath
)
[string[]]$Selector = @(
'ComputerName'
)
if ($ShowPath) {
@Chirishman
Chirishman / GraylogBootstrap.sh
Created June 5, 2018 17:23
Graylog Ubuntu Bootstrap
sudo apt update
sudo apt full-upgrade -y
sudo apt install -y default-jre apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
sudo apt update
sudo apt install elasticsearch mongodb -y
wget https://packages.graylog2.org/repo/packages/graylog-2.4-repository_latest.deb