This file contains hidden or 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.Diagnostics; | |
| public static class SystemInfoHelper | |
| { | |
| // Stores last CPU and time samples to compute deltas | |
| private static TimeSpan _lastCpu = TimeSpan.Zero; | |
| private static DateTime _lastSampleTime = DateTime.UtcNow; |
This file contains hidden or 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; | |
| public class Global : System.Web.HttpApplication | |
| { | |
| protected void Application_Start(object sender, EventArgs e) | |
| { | |
| HeartbeatService.Start(); | |
| } | |
| protected void Application_Error(object sender, EventArgs e) |
This file contains hidden or 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
| Sub DiagnosticoSheets() | |
| Dim wbThis As Workbook, wbActive As Workbook | |
| Dim msg As String | |
| Set wbThis = ThisWorkbook | |
| Set wbActive = ActiveWorkbook | |
| msg = "ThisWorkbook: " & wbThis.Name & vbCrLf | |
| msg = msg & "ActiveWorkbook: " & IIf(wbActive Is Nothing, "(nenhum)", wbActive.Name) & vbCrLf | |
| msg = msg & "ThisWorkbook.Sheets.Count = " & wbThis.Sheets.Count & vbCrLf |
This file contains hidden or 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
| Sub PreencherSheet2(json As Object) | |
| Dim ws As Worksheet | |
| Set ws = ThisWorkbook.Sheets("Sheet2") | |
| ' Limpa a sheet toda | |
| ws.Cells.Clear | |
| ' JSON deve ser um array de objetos | |
| If json.Count = 0 Then Exit Sub |
This file contains hidden or 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
| Sub ParseJsonToSheet(jsonText As String, sheetName As String) | |
| Dim ws As Worksheet | |
| Set ws = ThisWorkbook.Sheets(sheetName) | |
| ws.Cells.Clear | |
| Dim json As String | |
| json = Trim(jsonText) | |
| ' Remove [ ] | |
| If Left(json, 1) = "[" Then json = Mid(json, 2) |
This file contains hidden or 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
| public class ApiKeyMiddleware | |
| { | |
| private readonly RequestDelegate _next; | |
| private readonly string _apiKey; | |
| private const string HeaderName = "x-api-key"; | |
| public ApiKeyMiddleware(RequestDelegate next, IConfiguration config) | |
| { | |
| _next = next; | |
| _apiKey = config["Security:ApiKey"]; |
This file contains hidden or 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
| for /r %i in (*) do powershell -NoProfile -Command "Unblock-File -Path '%~fi'" |
This file contains hidden or 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
| # Lista versões comuns do Office (16.0 = 2016/2019/365, 15.0 = 2013, 14.0 = 2010) | |
| $officeVersions = @("16.0", "15.0", "14.0") | |
| foreach ($version in $officeVersions) { | |
| $path = "HKCU:\Software\Microsoft\Office\$version\Excel\Security" | |
| if (Test-Path $path) { | |
| Write-Output "Aplicando configuração para Excel versão $version..." | |
| # Cria a chave se não existir |
This file contains hidden or 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
| "1073741824" <!-- 1 GB --> | |
| <system.web> | |
| <httpRuntime maxRequestLength="2097151" executionTimeout="600" /> | |
| </system.web> | |
| <system.webServer> | |
| <security> | |
| <requestFiltering> |
This file contains hidden or 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.IO; | |
| using System.ServiceModel; | |
| using System.Windows.Forms; | |
| namespace WcfFileUploadClient | |
| { | |
| public partial class Form1 : Form | |
| { | |
| public Form1() |