This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a mobile account for a user | |
sudo /System/Library/CoreServices/ManagedClient.app/Contents/Resources/createmobileaccount -n <username> | |
# Delete a user's mobile account | |
sudo dscl . delete /Users/<username> | |
# List all AD accounts on machine | |
dscl . list /Users UniqueID | awk '$2 > 1000 { print $1 }' | |
# Enable/Disable mobile account support on machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove McAfee EPO | |
cd /Library/McAfee/cma | |
sudo ./uninstall.sh | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsInArray(string[] array, string value) | |
{ | |
foreach (string member in array) | |
{ | |
if (member == value) | |
{ | |
return true; | |
} | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ExportDataSet(DataSet ds, string format, string filename, bool boolGridLines, string caption) | |
{ | |
// format = "ms-excel", "ms-word" | |
HttpContext.Current.Response.Clear(); | |
HttpContext.Current.Response.ContentType = "application/vnd." + format; | |
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + filename); | |
HttpContext.Current.Response.Charset = ""; | |
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); | |
System.IO.StringWriter sw = new System.IO.StringWriter(); | |
System.Web.UI.HtmlTextWriter htw = new HtmlTextWriter(sw); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/ManagedClient.app/Contents/Resources/createmobileaccount -n <username> | |
sudo createhomedir -c -u <username> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of multiple LEFT OUTER JOINs in LINQ query syntax | |
// Equivalent of: SELECT <blahblah> FROM requests r LEFT JOIN employees e ON e.emplid = r.emplid LEFT JOIN employees m ON m.emplid = r.mgrid LEFT JOIN locations l ON l.locid = request.locid | |
using System.Linq; | |
using (Entities db = new Entities()) | |
{ | |
var rows = | |
from request in db.requests | |
from employee in db.employees.Where(e => e.emplid == request.emplid).DefaultIfEmpty() |
OlderNewer