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
| /// <summary> | |
| /// Provides helper methods to retrieve runtime and assembly-related information | |
| /// about the currently executing application. | |
| /// </summary> | |
| /// <remarks> | |
| /// This class is designed to be framework-agnostic and can be safely used in | |
| /// desktop, service, and web applications. | |
| /// | |
| /// When running under IIS, the application entry assembly may not represent | |
| /// the web application itself (it may resolve to the IIS worker process instead). |
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 HeartbeatService : IDisposable | |
| { | |
| private readonly HeartbeatSettings _cfg; | |
| private Timer _timer; | |
| private bool _running; | |
| public HeartbeatService(HeartbeatSettings cfg) | |
| { | |
| _cfg = cfg; | |
| } |
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
| <system.webServer> | |
| <security> | |
| <requestFiltering> | |
| <fileExtensions> | |
| <add fileExtension=".svc" allowed="true" /> | |
| </fileExtensions> | |
| </requestFiltering> | |
| </security> | |
| </system.webServer> |
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.Concurrent; | |
| using System.IO; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| /// <summary> | |
| /// Thread-safe logger for web APIs with buffered writing and daily rotation. | |
| /// The file is only opened during flush, allowing safe moves at the end of the day. |
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
| ui "default" { | |
| // Access only locally (recommended) | |
| listen_address = "127.0.0.1:12345" | |
| // For remote access: "0.0.0.0:12345" | |
| } |
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 static class TimeSpanFormatter | |
| { | |
| public static string ToReadableString(TimeSpan ts) | |
| { | |
| var parts = new List<string>(); | |
| if (ts.Days > 0) | |
| parts.Add($"{ts.Days} day{(ts.Days > 1 ? "s" : "")}"); | |
| if (ts.Hours > 0) |
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 |
NewerOlder