View robocopy_exclude_existing_files.cmd
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
robocopy c:\Sourcepath c:\Destpath /E /XC /XN /XO | |
:: /E makes Robocopy recursively copy subdirectories, including empty ones. | |
:: /XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those. | |
:: /XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those. | |
:: /XO excludes existing files older than the copy in the source directory. Robocopy normally overwrites those. | |
:: With the Changed, Older, and Newer classes excluded, Robocopy will exclude files existing in the destination directory. |
View is_bst.php
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
/* 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; | |
} |
View dsquery_all_attr.cmd
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
dsquery * "OU=User Accounts,DC=your,DC=domain,DC=com" -filter "(samaccountname=USER)" -attr * |
View myip.sh
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
#!/bin/bash | |
# Displays my ip addresses | |
ifconfig | grep "inet " | cut -f2 -d " " |
View FindControlRecursive.cs
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
// Digs through the control hierarchy starting at a root control | |
// stopping when the ID matches | |
private static Control FindControlRecursive(Control root, string id) | |
{ | |
if (root.ID == id) | |
return root; | |
foreach (Control control in root.Controls) | |
{ |
View nicks_math_problem.js
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
// My 11 year old's 6th grade homework one day: https://pbs.twimg.com/media/DLVjmkXUEAAF2_D.jpg | |
// Problem of the Week: Find the largest whole number less than 2007 that is divisible by 2, 3, 4, 5, 6, and 7. | |
// He wrote down 1680 and wanted me to check to see if he was right. | |
// Checked it the easiest way I knew. | |
for (var i = 2007; i > 0; i--) | |
if (i % 7 == 0) | |
if (i % 6 == 0) | |
if (i % 5 == 0) | |
if (i % 4 == 0) |
View replaceCharAt.js
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
String.prototype.replaceCharAt = function (index, character) { | |
return this.substr(0, index) + character + this.substr(index + character.length); | |
} |
View isAnagram.js
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
function isAnagram(phrase1, phrase2) { | |
return phrase1.split("").sort().join("") === phrase2.split("").sort().join(""); | |
} |
View CalculateNumberOfWorkDays.sql
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
/* Calculates the difference between dates excluding weekends */ | |
ALTER FUNCTION [dbo].[CalculateNumberOfWorkDays] (@StartDate datetime, @EndDate datetime) | |
RETURNS int | |
AS | |
BEGIN | |
SET @StartDate = DATEADD(dd, DATEDIFF(dd, 0, @StartDate), 0) | |
SET @EndDate = DATEADD(dd, DATEDIFF(dd, 0, @EndDate), 0) | |
View os-x_filevault2.sh
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
# 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 |
NewerOlder