Skip to content

Instantly share code, notes, and snippets.

View zgardner's full-sized avatar

Zach Gardner zgardner

View GitHub Profile
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="false">
<proxy
proxyaddress="http://127.0.0.1:8888"
bypassonlocal="true"
/>
<bypasslist/>
<module/>
</defaultProxy>
</system.net>
@zgardner
zgardner / Regex for non-ASCII characters
Created April 22, 2015 12:06
Regex for non-ASCII characters
[^\x00-\x7F]+
@zgardner
zgardner / Microsoft SQL Server equivalent to SHOW PROCESSLIST
Created March 23, 2015 17:43
Microsoft SQL Server equivalent to SHOW PROCESSLIST
select * from master..sysprocesses
@zgardner
zgardner / Log date, time, and milliseconds to console in C# with stack traced spaces
Last active August 29, 2015 14:17
Log date, time, and milliseconds to console in C# with stack traced spaces
System.Diagnostics.Debug.WriteLine("ZGZGZG " + new String(' ', Environment.StackTrace.Split('\n').Length) + " | " + System.DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff") + " APICall Class Method action");
@zgardner
zgardner / Capture Microsoft SQL Server Traffic from Localhost
Last active August 29, 2015 14:17
Capture Microsoft SQL Server Traffic from Localhost
1) [Download Microsoft Network Monitor](http://www.microsoft.com/en-us/download/details.aspx?id=4865)
2) Once installed, go to Tools -> Options -> Parser Profiles. Right click on Windows, and Set as Active.
3) Obtain the IP address of the DB server. (e.g. 1.1.1.1)
4) Start a new trace, and use the filter:
IPv4.Address == 1.1.1.1
myDBContext.Database.Log = message => System.Diagnostics.Debug.WriteLine(message);
@zgardner
zgardner / find_unterminated_scripts.php
Last active December 29, 2015 10:39
Debugging PHP scripts that don't finish
<?
global $LOG_FILE_NAME;
$LOG_FILE_NAME = session_save_path() . '/' . uniqid('log_file_') . microtime(true);
file_put_contents($LOG_FILE_NAME . '.START', print_r($_REQUEST, true) . print_r($_SERVER, true) . print_r($_SESSION, true));
function log_file_shutdown_function () {
global $LOG_FILE_NAME;