This file contains hidden or 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
// Newlines, tabs and non-printable unicode characters | |
private static final String sanitizePattern = "(\\r|\\n|\\t|\\p{C})"; | |
private static final String whitespacePattern = " +"; | |
private static final String replacementString = " "; | |
private static String sanitize(String text) { | |
return text.replaceAll(sanitizePattern, replacementString); | |
} |
This file contains hidden or 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
{ | |
"editor.tabSize": 2, | |
"editor.renderWhitespace": "none", | |
"workbench.iconTheme": "vs-seti", | |
"editor.minimap.enabled": true, | |
"terminal.integrated.shell.windows": "c:\\windows\\system32\\cmd.exe", | |
"terminal.integrated.shellArgs.windows": [ | |
"/k", | |
"c:\\program files\\git\\bin\\bash.exe" | |
], |
This file contains hidden or 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
Dir | Rename-Item –NewName { $_.name.replace(' ','_') -replace '[()]','' } |
This file contains hidden or 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
echo '{"somePassword": "password", "someSecret": "secret", "somethingElse": unchanged"}' \ | |
| sed '/\(Password": *"\|Secret": *"\)[^"]*\("\)/ s//\1*****\2/g' | |
# {"somePassword": "*****", "someSecret": "*****", "somethingElse": unchanged"} |
This file contains hidden or 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
-- Accidently closed an unsaved tab in SQL Server Management Studio, losing my query | |
-- Found out you can get all queries ran against the server: | |
SELECT | |
execquery.last_execution_time AS [Date Time], | |
execsql.text AS [Script] | |
FROM | |
sys.dm_exec_query_stats AS execquery | |
CROSS APPLY sys.dm_exec_sql_text(execquery.sql_handle) AS execsql | |
ORDER BY |
This file contains hidden or 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 class DictionaryExtension | |
{ | |
public static TValue GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key) where TValue : class | |
{ | |
TValue value; | |
return dictionary.TryGetValue(key, out value) | |
? value | |
: default(TValue); | |
} | |
} |
This file contains hidden or 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-Content C:\temp\mylogfile.log -tail 100 –wait | Select-String 'search' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 () { | |
var dice = (function (name) { | |
var root = typeof window !== 'undefined' ? window : global, | |
had = Object.prototype.hasOwnProperty.call(root, name), | |
prev = root[name], | |
me = root[name] = {}; | |
if (typeof module !== 'undefined' && module.exports) { | |
module.exports = me; | |
} | |
me.noConflict = function () { |
This file contains hidden or 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
// http://stackoverflow.com/a/14794066/136381 | |
function isInt(value) { | |
var x; | |
if (isNaN(value)) { | |
return false; | |
} | |
x = parseFloat(value); | |
return (x | 0) === x; | |
} |