Skip to content

Instantly share code, notes, and snippets.

@ubergoober
ubergoober / DateTimeConversions.cs
Created May 7, 2014 17:39
Convert CurrentDateTime to Epoch in C#
public long GetEpochTime() {
DateTime dtCurTime = DateTime.Now;
DateTime dtEpochStartTime = Convert.ToDateTime("1/1/1970 8:00:00 AM");
TimeSpan ts = dtCurTime.Subtract(dtEpochStartTime);
long epochtime;
epochtime = ((((((ts.Days * 24) + ts.Hours) * 60) + ts.Minutes) * 60) + ts.Seconds);
return epochtime;
}
@ubergoober
ubergoober / IsJqueryLoaded.js
Last active August 29, 2015 14:01
Check if jQuery is loaded from a browser console
// Credits to : http://blog.smalldo.gs/2011/09/jquery-load-check/
// check if jquery is loaded from a browser console
if (jQuery)
console.dir("jQuery "+$().jquery +" loaded");
else
console.dir("jQuery NOT loaded");
if($.ui)
console.dir("jQuery UI "+$.ui.version+" loaded");
@ubergoober
ubergoober / web.config.xml
Created May 7, 2014 17:43
Override IE Compatibility Mode
<!--
add to web.config
several options available
reference (note there are additional references on this page):
http://stackoverflow.com/questions/6156639/x-ua-compatible-is-set-to-ie-edge-but-it-still-doesnt-stop-compatibility-mode
-->
<system.webServer>
<httpProtocol>
<customHeaders>
@ubergoober
ubergoober / JavascriptRedirect.html
Created May 7, 2014 17:44
No Javascript redirect with message
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript">
document.write('Your browser complies with my needs... ');
@ubergoober
ubergoober / WMISchedules.ini
Created May 7, 2014 17:45
WMI Schedule IDs
SCHEDULE_ID_HARDWARE_INVENTORY = "{00000000-0000-0000-0000-000000000001}";
SCHEDULE_ID_SOFTWARE_INVENTORY = "{00000000-0000-0000-0000-000000000002}";
SCHEDULE_ID_DATA_DISCOVERY_RECORD = "{00000000-0000-0000-0000-000000000003}";
SCHEDULE_ID_FILE_COLLECTION = "{00000000-0000-0000-0000-000000000010}";
SCHEDULE_ID_MACHINE_POLICY_ASSIGNMENTS_REQUEST = "{00000000-0000-0000-0000-000000000021}";
SCHEDULE_ID_MACHINE_POLICY_EVALUATION = "{00000000-0000-0000-0000-000000000022}";
SCHEDULE_ID_REFRESH_DEFAULT_MANAGEMENT_POINT = "{00000000-0000-0000-0000-000000000023}";
SCHEDULE_ID_REFRESH_LOCATION_AD_SITE_OR_SUBNET = "{00000000-0000-0000-0000-000000000024}";
SCHEDULE_ID_REQUEST_TIMEOUT_VALUE_FOR_TASKS = "{00000000-0000-0000-0000-000000000025}";
SCHEDULE_ID_REQUEST_USER_ASSIGNMENTS = "{00000000-0000-0000-0000-000000000026}";
@ubergoober
ubergoober / DisableScriptDebuggingVS
Created May 7, 2014 17:46
Disable all script debugging in Visual Studio and IE8
ref: http://blogs.msdn.com/b/greggm/archive/2009/04/06/disabling-script-debugging-in-vs-2008-ie8.aspx
Disable all script debugging in Visual Studio and IE8:
Open a new command prompt (start->run, cmd.exe). If you are on a 64-bit computer this needs to be a 32-bit prompt (start->run, c:\windows\syswow64\cmd.exe)
reg add HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {4FF9DEF4-8922-4D02-9379-3FFA64D1D639} /f
If you are using Visual Web Developer Express, replace 'VisualStudio' with 'VWDExpress':
reg add HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {4FF9DEF4-8922-4D02-9379-3FFA64D1D639} /f
If you want to restore your computer so that you can debug scripts again:
@ubergoober
ubergoober / ClearWindowsAuthentication.js
Created May 7, 2014 17:48
Clear Windows Authentication in IE javascript
// This is an attempt at clearing Windows Authentication in IE when setup in IIS as the authentication method.
// This is no way a solution. Only a hack that semi worked.
javascript:try {document.execCommand("ClearAuthenticationCache");}
catch (e) { }
location.href('/');
@ubergoober
ubergoober / GoogleSuggestURL
Created May 7, 2014 18:21
Google Suggest auto complete URL
http://google.com/complete/search?output=toolbar&q=[query+words]
@ubergoober
ubergoober / RDPSettings.txt
Last active August 29, 2015 14:01
Complete RDP file settings
Alternate Shell:s:<string>
AudioMode:i:<int>
Authentication Level:i:<int>
AutoReconnect Max Retries:i:<int>
AutoReconnection Enabled:i:<0 or 1>
BitmapCacheSize:i:<int>
BitmapPersistCache16Size:i:<int>
BitmapPersistCache24Size:i:<int>
BitmapPersistCache32Size:i:<int>
BitmapPersistCacheSize:i:<int>
@ubergoober
ubergoober / jQueryToASP.js
Created May 7, 2014 18:26
jQuery Ajax call to ASP.NET Services simple example
function My_jQuery_AjaxCall_To_ASPServices_Example() {
$.ajax({
url: 'HTTP://WEBPAGE.URL/AJAXSERVICE',
dataType: 'json',
data: JSON.stringify({PARAM1: "STRINGVALUE", PARAM2: INTVALUE}),
type: 'post',
contentType: "application/json; charset=utf-8",
success: function (data) {
$('#DIVWITHIDNAMETOUPDATE').html(data.d);