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
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
### Source: https://www.morgantechspace.com/2015/06/powershell-find-machine-name-from-ip-address.html | |
## Get Computer Name from IP | |
# Set the known IP Address (variable not required) | |
# NOTE: MUST be enclosed in quotes | |
$ipAddress= "192.168.1.54" | |
[System.Net.Dns]::GetHostByAddress($ipAddress).Hostname | |
## Get IP from Computer Name | |
# Set the known computer name (variable not required) | |
# NOTE: MUST be enclosed in quotes |
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 Column Name from a table | |
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = @table; | |
-- Get total number of Columns | |
SELECT COUNT(*) FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = @table; | |
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
EXEC sys.sp_linkedservers | |
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
openssl x509 -in CERT_NAME -text -noout |
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
SELECT * FROM @table | |
WHERE | |
@column IN ( | |
SELECT @column FROM @table | |
GROUP BY @column HAVING COUNT(*) > 1) | |
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
LEFT(@column, IIF(CHARINDEX('@needle', @column) > 0, CHARINDEX(@needle, @column) - 1, LEN(@column))) | |
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
SELECT | |
ROW_NUMBER() OVER (ORDER BY @id) AS num | |
[, columns] | |
FROM @table | |
WHERE | |
@id BETWEEN @start AND @end | |
ORDER BY @id | |
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
<?php | |
// Multi-dimensional Array to search through | |
$a = [ | |
[ | |
'item' => 1, | |
'code' => 100 | |
], | |
[ | |
'item' => 2, | |
'code' => 200 |
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 function verifyUniqueFileName($fileName, $pathToCheck, $fileExtension) | |
{ | |
// Check for upper and lower case file extension | |
$extensionsBrace = "{" . $fileExtension . "," . strtoupper($fileExtension) . "}"; | |
// Require GLOB_BRACE for linux style multi-glob | |
$filesCollection = glob($pathToCheck . "*" . $extensionsBrace, GLOB_BRACE); | |
$files = array_map(function($item) { | |
// Get the tail of the path URI | |
return substr($item, strrpos($item, '/') + 1); |