Skip to content

Instantly share code, notes, and snippets.

View scruffydan's full-sized avatar

Dan Moutal scruffydan

View GitHub Profile
@scruffydan
scruffydan / unlock.bat
Created January 3, 2018 05:28
Unlock domain account from CMD
Net user loginname /DOMAIN /active:YES
@scruffydan
scruffydan / toggle-password sync.ps1
Created November 14, 2017 19:41
Fix Azure AD sync passwords not syncing
# Steps:
# Run command in PowerShell on the DirSync server. ($adConnector and $aadConnector are found in Connectors tab in Synchronization Service Manager)
# Perform Full Sync command in PowerShell.
# Azure AD Password toggle:
$adConnector = "<CASE SENSITIVE AD CONNECTOR NAME>"
$aadConnector = "<CASE SENSITIVE AAD CONNECTOR NAME>"
Import-Module adsync
$c = Get-ADSyncConnector -Name $adConnector
$p = New-Object Microsoft.IdentityManagement.PowerShell.ObjectModel.ConfigurationParameter “Microsoft.Synchronize.ForceFullPasswordSync”, String, ConnectorGlobal, $null, $null, $null
@scruffydan
scruffydan / Robocopy Scripts
Last active April 5, 2018 17:19
Robocopy Scripts
A small collection of useful robocopy scripts

Keybase proof

I hereby claim:

  • I am scruffydan on github.
  • I am scruffydan (https://keybase.io/scruffydan) on keybase.
  • I have a public key ASB-VZfiKVizwBQ7MUxgsVJL3_ZfOhnkgVBIC01Ev_7fSAo

To claim this, I am signing this object:

/**
* Utility function to check if a gravatar exists for a given email or id
* @param int|string|object $id_or_email A user ID, email address, or comment object
* @return bool if the gravatar exists or not
*/
function validate_gravatar($id_or_email) {
//id or email code borrowed from wp-includes/pluggable.php
$email = '';
STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ];
then
defaults write com.apple.finder AppleShowAllFiles NO
else
@scruffydan
scruffydan / ddns.sh
Last active April 20, 2021 06:02
Shell script to fetch public ip address and update Amazon Rout53 DNS. Requires cli53 (https://github.com/barnybug/cli53). If run from crontab you might need to include the full path to cli53 in line 31. Type `which cli53` to get full path.
#!/bin/sh
TTL="300"
ZONE="example.com"
HOSTS="@ subdomain0 subdomain1" #subdomains seperated by spaces
LASTIP_CHECK="example.com" #domain to check to se if current IP matches public DNS records
# Use -f to force ip change
if echo "$1" | grep -q "\-f" ; then
FORCE=true