Skip to content

Instantly share code, notes, and snippets.

View FabianoCampos's full-sized avatar

Fabiano Campos FabianoCampos

View GitHub Profile
@FabianoCampos
FabianoCampos / dockerfile
Created May 14, 2024 12:09
Processo para gerar imagem docker com tesseract
...
RUN apt update && apt-get install -y libleptonica-dev
RUN ls -la /usr/lib/x86_64-linux-gnu/
WORKDIR /app
RUN mkdir tmp
RUN apt-get install -y automake libtool pkg-config
RUN wget -q https://github.com/tesseract-ocr/tesseract/archive/5.2.0.tar.gz \
&& tar -zxvf 5.2.0.tar.gz -C /app/tmp \
@FabianoCampos
FabianoCampos / Dockerfile
Created November 24, 2021 20:16
Dockerfile para C# com instalação de fonts
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
#resolve problema de biblioteca responsavel por listar as fonts instaladas
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y libgdiplus
RUN apt-get install -y libc6-dev
@FabianoCampos
FabianoCampos / ConfiguracaoNHibernate.cs
Created March 20, 2020 12:11
Configurações para NHibernate
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
namespace ConfiguracaoNHibernate
{
public class Configuracao
{
@FabianoCampos
FabianoCampos / MimeTypes.js
Last active March 3, 2020 11:15
Retorna o tipo de conteúdo - ContentType - de acordo com a extensão do arquivo
var FacUtils = FacUtils || {};
FacUtils.File = FacUtils.File || {};
FacUtils.File.MimeTypes = {
Dicionario : {
"3dm": "x-world/x-3dmf",
"3dmf": "x-world/x-3dmf",
"a": "application/octet-stream",
"aab": "application/x-authorware-bin",
"aam": "application/x-authorware-map",
@FabianoCampos
FabianoCampos / QtdPagesPDF.js
Created November 28, 2019 16:47
Pegar a quantidade de páginas do arquivo com JavaScript
var input = document.getElementById("files");
var reader = new FileReader();
reader.readAsBinaryString(input.files[0]);
reader.onloadend = function(){
var count = reader.result.match(/\/Type[\s]*\/Page[^s]/g).length;
console.log('Number of Pages:',count );
}
public class LigarDesligarVM
{
/* informações de token e o estado correto devem ser tratados antes*/
public void Ligar(TokenCredentials credentialstring, string subscriptionId, string resourceGroup, string nomeDaVM)
{
var computeManagementClient = new ComputeManagementClient(credential) { SubscriptionId = subscriptionId };
computeManagementClient.VirtualMachines.Start(resourceGroup, nomeDaVM);
}
public void Desligar(TokenCredentials credentialstring, subscriptionId, string resourceGroup, string nomeDaVM)
@FabianoCampos
FabianoCampos / openssl_commands.md
Created September 28, 2018 13:29 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@FabianoCampos
FabianoCampos / SaveChangesEntity.cs
Last active February 11, 2020 11:36
Para quando houver erro: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details
/**
Para quando houver erro:
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
*/
try
{
contexto.SaveChanges();
}
catch (DbEntityValidationException e)
{
@FabianoCampos
FabianoCampos / Comando.txt
Created September 21, 2018 16:19
Gerar assinatura digital
Efetuar download do openssl
http://slproweb.com/products/Win32OpenSSL.html
================================
Comando 1:
genrsa -des3 -out fabiano.key 4096
Comando 2:
req -new -x509 -days 3650 -key fabiano.key -out fabiano.crt
@FabianoCampos
FabianoCampos / EntityFramework.cs
Created September 21, 2018 16:05
Row_number over (Partition by yyy) em Entity Framework
_contexto.Tramitacao
.Where(x => entrada.Contains(x.IdDocumento))
.GroupBy(x => new { x.IdDocumento })
.Select(g => g.OrderBy(e=> e.IdDocumento).ThenByDescending(e => e.Data).Take(1))
.SelectMany(e => e.Select(x => new TramitacaoDocumentoModel
{
IdDocumento = x.IdDocumento,
IdStatus = x.IdStatus,
DataTramitacao = x.Data
}));