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
Private Declare PtrSafe Function CertOpenStore Lib "Crypt32.dll" ( _
ByVal lpszStoreProvider As String, _
ByVal dwEncodingType As Long, _
ByVal hCryptProv As LongPtr, _
ByVal dwFlags As Long, _
ByVal pvPara As LongPtr) As LongPtr
Private Declare PtrSafe Function CertCloseStore Lib "Crypt32.dll" ( _
ByVal hCertStore As LongPtr, _
ByVal dwFlags As Long) As Long
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
public class Result<T>
{
public T Value { get; }
public string Error { get; }
public bool IsSuccess => Error == null;
private Result(T value, string error)
{
Value = value;
Error = error;
Sub RequisicaoWinHTTP()
' Cria o objeto WinHttpRequest
Dim http As Object
Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
' URL de destino
Dim url As String
url = "https://jsonplaceholder.typicode.com/posts/1"
On Error GoTo ErroHandler
Sub RequisicaoHTTPUsandoProxyAutomatico()
Dim HTTP As Object
Dim URL As String
Dim Resultado As String
' URL para teste
URL = "http://www.google.com"
' Criação do objeto ServerXMLHTTP
Set HTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
Sub MostrarConfiguracoesProxy()
Dim WinHttpReq As Object
Dim ProxyConfig As String
' Cria um objeto WinHTTP
Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
' Recupera as configurações de proxy do sistema
On Error Resume Next
WinHttpReq.SetProxy 0
Sub getPeople()
Dim req As MSXML2.ServerXMLHTTP60
Dim Parsed As Dictionary
Dim i As Integer
Dim Results As Collection
Dim Value As Dictionary
Set req = New MSXML2.ServerXMLHTTP60
api_url = "https://swapi.dev/api/people/"
@pedroinfo
pedroinfo / CaseWhenVivi.sql
Last active January 19, 2024 17:24
Case When Example - Vivi
Use MyDb
GO
DROP TABLE IF EXISTS Tb_Funcionario
CREATE TABLE Tb_Funcionario
(
Id INT NOT NULL,
Nome VARCHAR(200),
DataNascimento DATE,
@pedroinfo
pedroinfo / CaseWhen.sql
Created July 28, 2023 17:59
Exemplo de CASE WHEN para Vivi
IF OBJECT_ID('tempdb..#Tb_Pessoa') IS NOT NULL
DROP TABLE #Tb_Pessoa
CREATE TABLE #Tb_Pessoa
(
Id INT,
Nome VARCHAR(100),
Estado VARCHAR(100)
)
@pedroinfo
pedroinfo / HappyInsert.sql
Created March 30, 2022 15:04
How to generate insert from select
IF OBJECT_ID('tempdb..#Personagens') IS NOT NULL DROP TABLE #Personagens
GO
CREATE TABLE #Personagens(
Id INT IDENTITY,
Nome VARCHAR(100),
Funcao VARCHAR(100)
)