Skip to content

Instantly share code, notes, and snippets.

View selfish's full-sized avatar

selfish

View GitHub Profile
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
@selfish
selfish / kill.mysql
Last active November 5, 2015 18:00
Investigate performance and kill sleeping connections
SELECT *
FROM information_schema.processlist;
SELECT concat('KILL ',id,';')
FROM information_schema.processlist
WHERE COMMAND = 'Sleep';
@selfish
selfish / isOdd.js
Last active November 5, 2015 17:54
Bitwise Operations Make life easier in JS:
function isOdd(number) {
return !!(number & 1);
}
isOdd(1); // true, 1 is odd
isOdd(2); // false, 2 is not odd
isOdd(357); // true, 357 is odd
@selfish
selfish / DeleteSched.bat
Last active April 30, 2016 23:41
Remove all windows scheduled tasks cotaining string 'stringToRemove'
FOR /f %%i in ('schtasks /query ^| FINDSTR stringToRemove') do schtasks /Delete /TN "%%i" /F
@selfish
selfish / lookupXML.vbs
Created August 13, 2014 15:47
VBS Lookup files in folders. (Execute: cscript lookupXML.vbs)
On Error Resume Next
Dim fso, StdOut, folders, files, ext
folders = Array(_
"c:\",_
"c:\users"_
)
@selfish
selfish / tables-by-column.mysql
Last active December 20, 2017 14:09
Find MySQL Tables containing a column by name
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('columnA','ColumnB')
AND TABLE_SCHEMA='YourDatabase';
-- OR:
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%columnA%'