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
using (var dbContext = new MainDbContext()) | |
{ | |
for (var i = 0; i < 100000; i++) | |
{ | |
dbContext.Logs.Add(new Log() | |
{ | |
Key = Guid.NewGuid().ToString("D"), | |
Data = "some random data:" + Guid.NewGuid().ToString("D"), | |
UpdatedDate = DateTime.UtcNow | |
}); |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace TestApp | |
{ | |
public class ParallelWhile |
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
using System; | |
using System.Collections.Concurrent; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Common.Async | |
{ | |
public class LimitedLengthActionPool : IDisposable | |
{ |
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
async function getUserProfile(userId) { | |
let [user, groups] = await Promise.all([ | |
db.getUser(userId), | |
db.getUserGroups(userId) | |
]); | |
return {userId, user, groups}; | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!--- | |
config based on | |
https://blogs.msdn.microsoft.com/friis/2016/08/25/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world-apps/ | |
https://blogs.msdn.microsoft.com/friis/2016/08/25/iis-with-url-rewrite-as-a-reverse-proxy-part-2-dealing-with-500-52-status-codes/ | |
To you this configs you need to add | |
HTTP_ACCEPT_ENCODING | |
HTTP_X_ORIGINAL_ACCEPT_ENCODING |
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
using System; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace WebApplication1 | |
{ |
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 timeout(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
let result = (async function() { | |
await timeout(3000); | |
console.log("done"); | |
})(); |
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
using System; | |
using System.Threading; | |
using GreenPipes; | |
using MassTransit; | |
namespace TestMassTransit | |
{ | |
public class VideoFileMessage | |
{ | |
public int Num { get; set; } |
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
// # .htaccess content sample | |
// RewriteRule ^/apache-mod-rules-redirect/(.*) /redirected?id=$1 [L,R=302] | |
using (StreamReader apacheModRewriteStreamReader = | |
File.OpenText(".htaccess")) | |
{ | |
var options = new RewriteOptions() | |
.AddApacheModRewrite(apacheModRewriteStreamReader); | |
app.UseRewriter(options); |
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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
namespace ApiModelingApp.Controllers | |
{ | |
[Route("api/generation")] | |
[ApiController] |