Skip to content

Instantly share code, notes, and snippets.

View pedroinfo's full-sized avatar

Pedro Xavier pedroinfo

  • São Paulo - BR - Solar System | Milky Way
View GitHub Profile
@pedroinfo
pedroinfo / gist:788683a57959199abac2e7275bb4bfd4
Last active December 5, 2025 18:07
PreencherJsonNaSheet2
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)
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"];
for /r %i in (*) do powershell -NoProfile -Command "Unblock-File -Path '%~fi'"
@pedroinfo
pedroinfo / Macros
Last active September 12, 2025 17:49
# 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
"1073741824" <!-- 1 GB -->
<system.web>
<httpRuntime maxRequestLength="2097151" executionTimeout="600" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
@pedroinfo
pedroinfo / Form1.cs
Last active September 10, 2025 17:31
WCF Upload Tests
using System;
using System.IO;
using System.ServiceModel;
using System.Windows.Forms;
namespace WcfFileUploadClient
{
public partial class Form1 : Form
{
public Form1()
@pedroinfo
pedroinfo / highlight.css
Created June 9, 2025 20:46
highlight.css
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbscript.min.js"></script>
<script>hljs.highlightAll();</script>
<pre><code class="language-vbscript">
Sub HelloWorld()
MsgBox "Hello from VBA!"
<configuration>
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="true" />
@pedroinfo
pedroinfo / Parenteses.cs
Created June 6, 2025 19:40
ParentesesRegex.cs
static string ExtrairValorEntreParenteses(string input)
{
var match = Regex.Match(input, @"\(([^)]*)\)");
return match.Success ? match.Groups[1].Value : null;
}
Sub EnviarComCertificadoCliente()
Dim http As Object
Dim url As String
Dim certSubject As String
Dim json As String
url = "https://sua-api.com/endpoint"
certSubject = "CN=Nome do seu certificado"