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
var mixColor = function(hexColorStart, hexColorEnd, percent) { | |
/* Example: | |
var startColor = '#FF8000'; | |
var endColor = '#0080FF'; | |
var t = []; | |
for(var i=0; i < 100; i += 10 ) { | |
var mix = mixColor(startColor, endColor, i); | |
t.push('<span style="display: inline-block; width: 20px; height: 60px; background-color: ' + mix + '"> </span>'); | |
} | |
document.getElementById('demo').innerHTML = t.join(''); |
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
/** | |
* WiFiAutoSelector.h - Include file for class WiFiAutoSelector | |
* Copyright (c) 2016 Andreas Schaefer <[email protected]> | |
* | |
* A class to pick a wifi network from a list, based on the | |
* highest receive signal strength, and connect to it. | |
* Inspired by "WiFiMulti" | |
* | |
* This source code is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU Lesser General Public |
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
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"userid": "mohit", "password":"password"}' http://mmedwebdemo.ddns.comp.nus.edu.sg:8080/comp.nuhs.jaxb/api/usr/login |
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
internal static class SqlMvaLibExtensions { | |
private static readonly DateTime _minSqlDateTime = new DateTime(1753, 1, 1); | |
private static readonly DateTime _maxSqlDateTime = new DateTime(9999, 12, 31, 23, 59, 59, 997); | |
internal static bool IsValidSqlDateTime(this System.DateTime dt) { | |
return (dt >= _minSqlDateTime && dt <= _maxSqlDateTime); | |
} | |
} |
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 Test-IsAdmin { | |
try { | |
$identity = [Security.Principal.WindowsIdentity]::GetCurrent() | |
$principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity | |
return $principal.IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator ) | |
} catch { | |
throw "Failed to determine if the current user has elevated privileges. The error was: '{0}'." -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
SELECT | |
GETUTCDATE() AS [DateTime], | |
[s_tst].[session_id], | |
[s_es].[login_name] AS [Login Name], | |
DB_NAME (s_tdt.database_id) AS [Database], | |
[s_tdt].[database_transaction_begin_time] AS [Begin Time], | |
[s_tdt].[database_transaction_log_bytes_used] AS [Log Bytes], | |
[s_tdt].[database_transaction_log_bytes_reserved] AS [Log Rsvd], | |
[s_est].text AS [Last T-SQL Text], | |
[s_eqp].[query_plan] AS [Last Plan] |
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
// go inside that folder: | |
cd /d "C:\$Windows.~BT" | |
// take over ownership | |
takeown /f *.* /R /D Y | |
// (go for coffee, takes a minute) | |
// grant full rights to everyone | |
icacls *.* /grant Everyone:(OI)(CI)F /T |
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
use mysql; | |
update user set password=PASSWORD("UlE3x:rtRt$12") where User='vhost_4711'; | |
flush privileges; |
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
var MD5 = function(s) { | |
function L(k,d) { return(k<<d)|(k>>>(32-d))} | |
function K(G,k){var I,d,F,H,x;F=(G&2147483648);H=(k&2147483648);I=(G&1073741824);d=(k&1073741824);x=(G&1073741823)+(k&1073741823);if(I&d){return(x^2147483648^F^H)}if(I|d){if(x&1073741824){return(x^3221225472^F^H)}else{return(x^1073741824^F^H)}}else{return(x^F^H)}} | |
function r(d,F,k){return(d&F)|((~d)&k)} | |
function q(d,F,k){return(d&k)|(F&(~k))} | |
function p(d,F,k){return(d^F^k)} | |
function n(d,F,k){return(F^(d|(~k)))} | |
function u(G,F,aa,Z,k,H,I){G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)} | |
function f(G,F,aa,Z,k,H,I){G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),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
// We extend the string object with a little helper function | |
// to convert a boolean value from a string to bool. | |
// var flag = "true"._toBool | |
Object.defineProperty(String.prototype, "_toBool", { | |
get : function() { | |
return (/^(true|1)$/i).test(this); | |
} | |
}); |