Skip to content

Instantly share code, notes, and snippets.

View davenewza's full-sized avatar
🎯
Focusing

Dave New davenewza

🎯
Focusing
View GitHub Profile
===============
Agent (v7.31.0)
===============
Status date: 2021-10-14 07:32:46.925 UTC (1634196766925)
Agent start: 2021-10-08 05:52:26.093 UTC (1633672346093)
Pid: 1
Go Version: go1.15.13
Python Version: 3.8.11
Build arch: amd64
@davenewza
davenewza / gist:e5b16f9952ad3bf069fecb0ac96c3608
Created April 9, 2020 13:50
Kego and Dave sessions: Example of using dependency injection
### DEPENDENCY INJECTION
## REPO DEFINITIONS
interface IBookRepository
{
Book FindBook(string isbn);
}
class MongoDbBookRepository : IBookRepository
@davenewza
davenewza / gist:16dc83a1a85377ffeec7349a01ff5b84
Created April 9, 2020 13:49
Kego & Dave sessions: Example of using polymorphism over if-statements
IF STATEMENT APPROACH
===================
function makeSound(string animal)
{
if(animal == "cat")
print("moew")
else if(animal == "dog")
print("woof")
public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR();
// Register singleton of service
services.AddSingleton<IMyService, MyService>();
// Build service provider
var provider = services.BuildServiceProvider();
@davenewza
davenewza / ThreadPool.md
Last active May 19, 2017 12:21 — forked from JonCole/ThreadPool.md
Intro to CLR ThreadPool Growth

ThreadPool Growth: Some Important Details

The CLR ThreadPool has two types of threads - "Worker" and "I/O Completion Port" (aka IOCP) threads.

  • Worker threads are used when for things like processing Task.Run(…) or ThreadPool.QueueUserWorkItem(…) methods. These threads are also used by various components in the CLR when work needs to happen on a background thread.
  • IOCP threads are used when asynchronous IO happens (e.g. reading from the network).

The thread pool provides new worker threads or I/O completion threads on demand (without any throttling) until it reaches the "Minimum" setting for each type of thread. By default, the minimum number of threads is set to the number of processors on a system.

Once the number of existing (busy) threads hits the "minimum" number of threads, the ThreadPool will throttle the rate at which it injects new threads to one thread per 500 milliseconds. This means that if your system gets a burst of work needing an IOCP thread, it will proces

@davenewza
davenewza / gist:a9ed0d796b17fb2ac34de9413c14db5c
Created October 27, 2016 07:35
IIS Detailed Error - 502.3 - Bad Gateway
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS Detailed Error - 502.3 - Bad Gateway</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}
code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}
.config_source code{font-size:.8em;color:#000000;}
pre{margin:0;font-size:1.4em;word-wrap:break-word;}