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
' Found on | |
' https://answers.microsoft.com/en-us/windows/forum/all/how-to-recover-your-windows-product-key/8687ef5d-4d32-41fc-9310-158f8e5f02e3 | |
Set WshShell = CreateObject("WScript.Shell") | |
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId")) | |
Function ConvertToKey(Key) | |
Const KeyOffset = 52 | |
i = 28 | |
Chars = "BCDFGHJKMPQRTVWXY2346789" |
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
const validFiscalCodeRegexp = /^([A-Za-z]{6}[\dlmnpqrstuvLMNPQRSTUV]{2}[abcdehlmprstABCDEHLMPRST]{1}[\dlmnpqrstuvLMNPQRSTUV]{2}[A-Za-z]{1}[\dlmnpqrstuvLMNPQRSTUV]{3}[A-Za-z]{1})$|(\d{11})$/; | |
const isValidFiscalCode = cf => validFiscalCodeRegexp.test(cf); |
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
// adb -d shell pm grant <app.package> <android.permission> | |
adb -d shell pm grant com.gsamlabs.bbm android.permission.BATTERY_STATS |
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
-- Thanks to Dustin Ryan | |
-- https://sqldusty.com/2015/07/08/tsql-script-to-find-foreign-key-references-to-a-given-column/ | |
SELECT OBJECT_NAME(f.object_id) as ForeignKeyConstraintName, | |
OBJECT_NAME(f.parent_object_id) TableName, | |
COL_NAME(fk.parent_object_id,fk.parent_column_id) ColumnName, | |
OBJECT_NAME(fk.referenced_object_id) as ReferencedTableName, | |
COL_NAME(fk.referenced_object_id,fk.referenced_column_id) as ReferencedColumnName | |
FROM sys.foreign_keys AS f |
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
/* | |
* https://codereview.stackexchange.com/questions/5572/string-isnullorempty-in-javascript | |
* Thanks to ndp (https://codereview.stackexchange.com/users/8041/ndp) | |
*/ | |
// Starting with: | |
return (!value || value == undefined || value == "" || value.length == 0); | |
// Looking at the last condition, if value == "", it's length MUST be 0. Therefore drop it: | |
return (!value || value == undefined || value == ""); | |
// But wait! In JS, an empty string is false. Therefore, drop value == "": | |
return (!value || value == undefined); |
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 COLUMN_NAME AS 'ColumnName' | |
,TABLE_NAME AS 'TableName' | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME LIKE '%MyName%' | |
ORDER BY TableName | |
,ColumnName; |
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 c.name AS 'ColumnName' | |
,t.name AS 'TableName' | |
FROM sys.columns c | |
JOIN sys.tables t ON c.object_id = t.object_id | |
WHERE c.name LIKE '%MyName%' | |
ORDER BY TableName | |
,ColumnName; |
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
const validEmailRegexp = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i; | |
const isValidEmail = email => validEmailRegexp.test(email); |
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
const roundDecimalPlaces = (num, decimalPlaces) => { | |
// default: 1 decimal places | |
decimalPlaces = !decimalPlaces ? 1 : decimalPlaces; | |
return Math.round(num * 10 * decimalPlaces) / (10 * decimalPlaces); | |
} |
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/sh | |
exiftool '-datetimeoriginal<filename' IMG_%Y%m%d_%H%M.jpg * |
NewerOlder