Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Gallant jongio

View GitHub Profile
@jongio
jongio / PhotoOrganizer.ps1
Created Mar 3, 2021
A PowerShell script to organize photos by date taken
View PhotoOrganizer.ps1
Param(
[string]$source,
[string]$dest,
[string]$format = "yyyy/yyyy_MM/yyyy_MM_dd"
)
$shell = New-Object -ComObject Shell.Application
function Get-File-Date {
[CmdletBinding()]
@jongio
jongio / azure-rest-apis-with-postman-pre-request-script.js
Created Feb 28, 2021
Postman Collection Bearer Token Pre-Request Script
View azure-rest-apis-with-postman-pre-request-script.js
if (!pm.collectionVariables.get("bearerToken") || Date.now() > new Date(pm.collectionVariables.get("bearerTokenExpiresOn") * 1000)) {
pm.sendRequest({
url: 'https://login.microsoftonline.com/' + pm.collectionVariables.get("tenantId") + '/oauth2/token',
method: 'POST',
header: 'Content-Type: application/x-www-form-urlencoded',
body: {
mode: 'urlencoded',
urlencoded: [
{ key: "grant_type", value: "client_credentials", disabled: false },
{ key: "client_id", value: pm.collectionVariables.get("clientId"), disabled: false },
@jongio
jongio / azure-rest-apis-with-insomnia-workspace.json
Last active Feb 26, 2021
Azure REST APIs with Insomnia Workspace
View azure-rest-apis-with-insomnia-workspace.json
{
"_type":"export",
"__export_format":4,
"__export_date":"2021-02-26T15:46:44.984Z",
"__export_source":"insomnia.desktop.app:v2020.5.2",
"resources":[
{
"_id":"req_7bbaa70817c34e55bf70f64a26c0eff2",
"parentId":"fld_e3ddc403c123493a9bdd56aa59192655",
"modified":1614354317200,
View MyTokenCredential.ts
class MyTokenCredential implements coreHttp.TokenCredential {
public token: string;
public expiresOn: number;
constructor(token: string, expiresOn?: Date) {
this.token = token;
this.expiresOn = expiresOn
? expiresOn.getTime()
@jongio
jongio / PowerBIGitHubRESTAPI.pq
Last active Jul 15, 2020
Power BI Query - GitHub REST API
View PowerBIGitHubRESTAPI.pq
let
BaseUrl = "https://api.github.com/search/issues",
Query = "q=azsdke2e",
Token = "enter your token here",
ItemsPerPage = 100,
Delay = 2,
GetItems = (PageNumber, ItemsPerPage) =>
let Page = "&page=" & Text.From(PageNumber),
PerPage = "&per_page=" & Text.From(ItemsPerPage),
Url = BaseUrl & "?" & Query & Page & PerPage,
View aksmanagedclusterfreesku.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.1",
"parameters": {
"clusterName": {
"type": "string",
"defaultValue": "aks101cluster",
"metadata": {
"description": "The name of the Managed Cluster resource."
}
View temp.cs
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using Azure.Core;
using Azure.Core.Diagnostics;
using Azure.Identity;
using DotNetEnv;
namespace azid
{
View adfauth.cs
using System;
using System.Threading.Tasks;
using Microsoft.Identity.Client;
using System.Text;
using System.Globalization;
using Microsoft.Azure.Management.DataFactory;
using Microsoft.Rest;
using Azure.Security.KeyVault.Secrets;
using Azure.Identity;
using Azure.Core;
View GraphAPIAuthTest.cs
using System;
using Azure.Identity;
namespace graphapitest
{
class Program
{
static void Main(string[] args)
{
var cred = new DefaultAzureCredential(new DefaultAzureCredentialOptions() { SharedTokenCacheUsername = "email@email.com" });
View pbiviz-pbiviz.json
{
"visual": {
"name": "liquidFillGauge",
"displayName": "liquidFillGauge",
"guid": "liquidFillGaugeCA6D0134FC6446EF90CC6934C9812269",
"visualClassName": "Visual",
"version": "1.0.0",
"description": "",
"supportUrl": "",
"gitHubUrl": ""