Skip to content

Instantly share code, notes, and snippets.

View alefcarlos's full-sized avatar
✌️
Focusing

Alef Carlos alefcarlos

✌️
Focusing
View GitHub Profile
public class HsmPool : IDisposable
{
internal bool disposedValue;
internal SocketPool buffer;
private readonly HSMContext settings;
static object _initializeBufferLock = new object();
public HsmPool(IOptions<HSMContext> context)
{
settings = context.Value;
using System;
using System.Collections.Concurrent;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
namespace Super.GlobalPlatform.HSM.Application
{
public class SocketPool : IDisposable
{
@alefcarlos
alefcarlos / SocketRingBuffer.cs
Created July 6, 2020 11:11
SockeRingbuffer wip
namespace Oragon.Common.RingBuffer.Specialized
{
public class SocketRingBuffer : DisposableRingBuffer<Socket>
{
public SocketRingBuffer(int capacity, Func<Socket> bufferFactory) : base(capacity, bufferFactory)
{
}
public override IAccquisitonController<Socket> Accquire() => new ScoketAccquisitonController(this.availableBuffer, this.WaitTime, this.itemFactoryFunc);
@alefcarlos
alefcarlos / SocketRingBuffer.cs
Created July 6, 2020 11:11
SockeRingbuffer wip
namespace Oragon.Common.RingBuffer.Specialized
{
public class SocketRingBuffer : DisposableRingBuffer<Socket>
{
public SocketRingBuffer(int capacity, Func<Socket> bufferFactory) : base(capacity, bufferFactory)
{
}
public override IAccquisitonController<Socket> Accquire() => new ScoketAccquisitonController(this.availableBuffer, this.WaitTime, this.itemFactoryFunc);
FROM alefcarlos/aspnet-grpc:3.0
WORKDIR /app
COPY publish/ .
ENTRYPOINT ["./RifeAi.Account.Grpc", "--urls", "http://+:81"]
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using PlusUltra.Grpc.WebServer.Hosting;
namespace GrpcSample
{
public class Startup : GrpcServerStartup
@alefcarlos
alefcarlos / Program.cs
Created July 23, 2019 02:28
DotNetThreadPool
class Program {
static void Main(){
//Obtém config(para ajustes finos de acordo com a necessidade)
var value = Convert.ToInt32(ConfigurationManager.AppSettings["MinThreads"]);
//Altera os valores, retorná true caso tenha conseguido
var success = ThreadPool.SetMinThreads(value, value);
//TODO: .....
var admin = require('firebase-admin');
var Excel = require('exceljs');
var serviceAccount = require(`${__dirname}/key.json`);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://log-controller.firebaseio.com'
});
var admin = require('firebase-admin');
var Excel = require('exceljs');
var serviceAccount = require(`${__dirname}/key.json`);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://log-controller.firebaseio.com'
});
@alefcarlos
alefcarlos / UserDatainfo.dart
Created May 29, 2019 20:03
Exemplo de classe singleton para informações de usuãrio.
import 'package:firebase_auth/firebase_auth.dart';
class UserDataInfo {
FirebaseUser _user;
UserDataInfo._();
String get id => _user.uid;
String get email => isLoggedIn ? _user.email : null;
bool get isLoggedIn => _user != null;