Skip to content

Instantly share code, notes, and snippets.

View saostad's full-sized avatar
🤠

saostad

🤠
View GitHub Profile
@saostad
saostad / read_from_windows_credential_manager.cpp
Last active February 26, 2021 03:38
read_from_windows_credential_manager.cpp
#include <Windows.h>
#include <WinCred.h>
#include <iostream>
using namespace std;
main()
{
PCREDENTIALA cred;
@saostad
saostad / MyAuthenticationProvider.ts
Last active March 11, 2021 14:31
get Azure graph token by custom authentication provider by client_id and client_secret
import { AuthenticationProvider } from "@microsoft/microsoft-graph-client";
const axios = require("axios").default;
const qs = require("qs");
const msGraph_AuthUrl = process.env.msGraph_AuthUrl;
const msGraph_client_id = process.env.msGraph_client_id;
const msGraph_client_secret = process.env.msGraph_client_secret;
const msGraph_tenant_id = process.env.msGraph_tenant_id;
export class MyAuthenticationProvider implements AuthenticationProvider {
/**
* This method will get called before every request to the msgraph server
@saostad
saostad / decode-base64-columns.sql
Last active August 18, 2021 13:30
How to decode base64 columns inline with T-SQL query
SELECT convert(varchar(max),cast(N'' as xml).value('xs:base64Binary(sql:column("MBAMPolicy.EncodedComputerName0"))', 'VARBINARY(MAX)')) AS [Computer Name]
@saostad
saostad / typescript-typescript-type-required-fields-based-on-other-fields.ts
Created July 7, 2021 21:21
typescript type required fields based on other fields
type a = {
c: "Hello";
/** ggg */
d: boolean;
e?: never;
} | {
c: "World";
d?: never;
/** hhh */
e: string;