Skip to content

Instantly share code, notes, and snippets.

• • • • • •

Adam Romig aromig

• • • • • •
View GitHub Profile
aromig / CreateJSAlertConfirm.cs
Created Jan 25, 2016
Dynamically create JavaScript alert & confirmation dialogs from server side C#
View CreateJSAlertConfirm.cs
public static void CreateAlert(string key, string alertString)
Page page = HttpContext.Current.Handler as Page;
if (page != null)
if (!page.ClientScript.IsStartupScriptRegistered(key))
page.ClientScript.RegisterStartupScript(typeof(Page), key, "<script language=\"JavaScript\">alert(\"" + alertString + "\");</script>");
aromig / IsInArray.cs
Created Jan 25, 2016
Check to see if a string exists in a string array
View IsInArray.cs
public static bool IsInArray(string[] array, string value)
foreach (string member in array)
if (member == value)
return true;
return false;
aromig / dsquery_all_attr.cmd
Last active Dec 3, 2019
dsquery - list all attributes for a user
View dsquery_all_attr.cmd
dsquery * "OU=User Accounts,DC=your,DC=domain,DC=com" -filter "(samaccountname=USER)" -attr *
# Command lines for missing functionality in El Capitan's Disk Utility.
# Verify Disk
sudo /usr/libexec/repair_packages --verify --standard-pkgs / 
# Repair Disk
sudo /usr/libexec/repair_packages --repair--standard-pkgs / 
# Verify Disk Permissions
sudo /usr/libexec/repair_packages --verify --standard-pkgs --volume / 
aromig / is_bst.php
Last active Nov 6, 2017
Detect if British Summer Time is in effect
View is_bst.php
/* Refactored to check actual timezone abbreviation versus a particular day */
public function is_BST() {
$theTime = time();
$tz = new DateTimeZone('Europe/London');
$transition = $tz->getTransitions($theTime, $theTime);
$abbr = $transition[0]['abbr'];
return $abbr == 'BST' ? true : false;
aromig /
Created Sep 22, 2015
cURL syntax for REST requests
# GET request
curl http://<url>
# View Header Information Only
curl http://<url> -I
# Include Header Information with request
curl http://<url> -i
# POST request w/ body in a file
# Get device names of network adapters
networksetup -listallhardwareports
# Get network service order
networksetup -listnetworkserviceorder
# List wireless SSIDs
networksetup -listpreferredwirelessnetworks <device>
# Get and Set search domains
# Remove McAfee EPO
cd /Library/McAfee/cma
sudo ./
# Remove VirusScan
cd /usr/local/McAfee
sudo ./uninstallMSC
# Force McAfee Check-in with EPO
# [C]hecks for new policies and tasks, Sends [P]roperties, [E]nforces polcies
# Bind to AD
sudo dsconfigad -a <computername> -u <username> -ou "" -domain <domain>
# Unbind from AD
# Can use a bogus username and password here
sudo dsconfigad -force -remove -u user -p pass
# Manually create a user profile for an AD user
sudo /System/Library/CoreServices/ -n <username>
sudo createhomedir -c -u <username>
# Enable a user to unlock FileVault2 drive
sudo fdesetup add -usertoadd <username>
# Disable a user from unlocking FileVault 2 drive
sudo fdesetup remove -user <username>
# Unlocking FileVault2 drive
diskutil cs list
diskutil cs unlockVolume <UUID_of_Logical_Volume> -stdinpassphrase