Skip to content

Instantly share code, notes, and snippets.

View dallin's full-sized avatar
💻
building something great

Dallin Hitchcock dallin

💻
building something great
View GitHub Profile
@dallin
dallin / RemoteWipe.ps1
Created April 12, 2023 19:40
Remote wipe a Windows 10/11 device
$namespaceName = "root\cimv2\mdm\dmmap"
$className = "MDM_RemoteWipe"
$methodName = "doWipeMethod"
$session = New-CimSession
$params = New-Object Microsoft.Management.Infrastructure.CimMethodParametersCollection
$param = [Microsoft.Management.Infrastructure.CimMethodParameter]::Create("param", "", "String", "In")
$params.Add($param)
@dallin
dallin / Create-DynamicDistributionGroup-Everyone.ps1
Created March 30, 2023 02:28
Create an "Everyone" distribution list with dynamic membership. Includes all active user accounts (no shared mailboxes) with a job title.
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
New-DynamicDistributionGroup -Name "Everyone" -Alias "everyone@example.com" -RecipientFilter "RecipientTypeDetails -eq 'UserMailbox' -and Title -ne `$null -and UserAccountControl -ne 'AccountDisabled, NormalAccount'"
@dallin
dallin / mysql-backup.sh
Last active September 17, 2021 21:10
Simple MySQL backup script
#!/bin/bash
database=""
username=""
password=""
backupdir="/home/forge/backups/mysql"
date=`date +%Y-%m-%d`
suffix="-${database}.sql.gz"
filename="${date}${suffix}"
@dallin
dallin / README.md
Last active August 13, 2021 18:59
UniFi USG Dynamic DNS with Namecheap (behind NAT)

UniFi USG Dynamic DNS with Namecheap (behind NAT)

This is useful if...

  1. Your USG sits behind another firewall (such as in an apartment complex or dorm)
  2. Your USG receives a private IP instead of a public one
  3. You are unable to put the other router in bridge mode or passthrough mode
  4. The other router forwards all ports for the public IP to your USG

Instructions

  1. Enable Dynamic DNS for your domain in Namecheap
  2. Create an A+Dynamic DNS record for the desired hostname
[
{
"code": "00283",
"name": "AARP (A United HealthCare Insurance Company)"
},
{
"code": "00344",
"name": "Absolute Total Care"
},
{
@dallin
dallin / HasUuidPrimaryKey.php
Created September 25, 2020 22:53
Trait for Laravel Eloquent models to use a UUID as their primary key
<?php
namespace App\Models\Concerns;
use Illuminate\Support\Str;
/**
* Model has a UUID primary key.
*/
trait HasUuidPrimaryKey
@dallin
dallin / open-popup-window-close-on-save.js
Last active April 17, 2020 19:15
Open a new window to add QB record, then close the window when the changes are saved
// This snippet will pop up a window (with specified size) to add
// a record, then close the window when the changes are saved.
// Use: in a Formula URL field
var text attachAddressToParentRecordUrl = URLRoot()&"db/"&Dbid()&"?a=API_EditRecord&rid="&[Record ID#]
& "&usertoken=" & "b4pjvn_m6mu_bdjdqxauri75jbrvmm5csns4vh"
& "&apptoken=" & "cm3s4ptbfj6gchcsmr4t3x3228u"
& "&_fid_33=";
var text addAddressWindowUrl = URLRoot() & "db/" & "bp2hi954g" & "?a=nwr&_fid_22=" & [Related Patient];
var number addAddressWindowWidth = 950;
# Created by Dallin Hitchcock on January 8, 2019
# Backs up $SourceDirectory or individual files that have been created since midnight
# Creates a zip file of the backups (name format yyyy-MM-dd.zip)
# Copies the zip file to $DestinationDirectory
# If the $KeepLast parameter is specified, only keeps that number of backups in $DestinationDirectory
param (
[Parameter(Mandatory,ValueFromPipelineByPropertyname)]
[ValidateNotNullOrEmpty()]
[string]$SourceDirectory,
@dallin
dallin / PingUpDown.bat
Created January 4, 2019 01:52
Pings an IP address and shows red or green
echo off & cls
:top
PING -n 1 192.168.1.1 | FIND "TTL="
IF ERRORLEVEL 1 (SET OUT=4F & echo Request timed out.) ELSE (SET OUT=2F)
color %OUT%
ping -n 2 -l 10 127.0.0.1 >nul
GoTo top
@dallin
dallin / keybase.md
Last active September 20, 2016 04:38
Keybase proof

Keybase proof

I hereby claim:

  • I am dallin on github.
  • I am dallin (https://keybase.io/dallin) on keybase.
  • I have a public key ASAlTXF-dRLYQmLl4IgkA7bpE7bn4FlhkwS7NElPTHbYDQo

To claim this, I am signing this object: