Skip to content

Instantly share code, notes, and snippets.

View detroitpro's full-sized avatar
☠️

Eric Polerecky detroitpro

☠️
View GitHub Profile
public class HttpClientAbstraction : IHttpClientAbstraction
{
public static HttpClient Client = new HttpClient();
public async Task<Result<T>> GetUrlAsync<T>(string url)
{
return await ExecuteAsync<T>(() => Client.GetAsync(url), url);
}
public async Task<Result<T, TT>> GetUrlAsync<T, TT>(string url)
{
return await ExecuteAsync<T, TT>(() => Client.GetAsync(url), url);
using Newtonsoft.Json;
using System;
namespace Core
{
public class Result
{
public bool Ok { get; set; }
public string Message { get; set; }
@detroitpro
detroitpro / find_candidate.py
Created January 5, 2018 19:55
Find Candidate UTXO
import random
import decimal
cost = 0.10
sending_amount = 0.71
class UTXO(object):
id = 0
amount = 0
@detroitpro
detroitpro / gist:693ae7aba8b7bc91fea66f3963dd3af0
Created November 19, 2017 03:15
blockstack verification
Verifying my Blockstack ID is secured with the address 14gciAJG7MMXuNM2ruEzQtFrbKoxEE261W https://explorer.blockstack.org/address/14gciAJG7MMXuNM2ruEzQtFrbKoxEE261W
@detroitpro
detroitpro / .editorconfig
Created June 22, 2017 20:53
Editor Config for C# / VS2017 / R#
root=true
[*]
indent_style = tab
indent_size = 4
[*.cs]
# Don't use 'this.'/'Me.' prefix for anything
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
@detroitpro
detroitpro / unit_test.md
Created February 19, 2017 15:58
How to unit teset EFCore

var builder = new DbContextOptionsBuilder().UseInMemoryDatabase();

var context = new MyContext(builder.Options); var users = Enumerable.Range(1, 10).Select(i => new User { Id = i }); context.Users.AddRange(users); context.SaveChanges();

@detroitpro
detroitpro / tv.conf
Created February 15, 2017 18:00
supervisor example
detroitpro@build:/etc/supervisor/conf.d$ cat teamvirtuoso.conf
[program:tv]
command=/usr/bin/dotnet /var/www/teamvirtuoso.com/teamvirtuoso.dll
directory=/var/www/teamvirtuoso.com/
autostart=true
autorestart=true
stderr_logfile=/var/log/tv.err.log
stdout_logfile=/var/log/tv.out.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=detroitpro

Keybase proof

I hereby claim:

  • I am detroitpro on github.
  • I am detroitpro (https://keybase.io/detroitpro) on keybase.
  • I have a public key ASAP-hep-tDSzRLdGeePy-Kksd0QubzekyrlVhMN_oLETgo

To claim this, I am signing this object:

@detroitpro
detroitpro / talk.md
Last active February 16, 2017 16:49
The Deployment of DotNet in the Land of Linux

Abstract:

For many .NET developers, Linux can seem like an alternate dimension. There are, however, many reason why you may want to deploy to linux and/or use MS SQL on Linux. During this talk we'll discuss the intricacies of running a complete non-windows stack. We will walk through all the decisions we made deploying our first “Linux first” web application, from what version of Linux (and why) to lessons learned while deploying and pointers on getting started today!

Presenters

Eric is one of the founding members of TeamVirtuoso, a software consulting company based out of southeast Michigan. We are an agile team that prides itself on building software the right way. Before starting TeamVirtuoso, Eric worked for over 10 years as a software consultant, specializing in the Microsoft tech stack.

namespace My.Common
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
public static class AsyncHelpers
{
/// <summary>