View OAuth2Middleware.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OAuth;
using Newtonsoft.Json.Linq;
View access-json-file.sql
/*
Create the Database Master Key, if needed
*/
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'My-L0ng&Str0ng_P4ss0wrd!';
GO
/*
Create database scoped credentials to store the Shared Access Signature (SAS)
needed to access the Azure Blob Container. More info on Azure Blob SAS here:
View azure-functions-save-form-data-to-sql-azure.sql
/*
Expected JSON:
{
"Subject": "Form's Subject",
"FirstName": "Davide",
"LastName": "Mauri",
"EmailAddress": "info@davidemauri.it",
"OtherField1": "OtherValue1",
View azure-functions-save-form-data-to-sql-azure.csx
#r "Newtonsoft.Json"
using System;
using System.Net;
using System.Net.Mail;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using Dapper;
using Newtonsoft.Json;
View get-r-home.sql
execute sp_execute_external_script
@language = N'R',
@script = N'OutputDataSet <- data.frame(R.home());'
with result sets (([R.home()] nvarchar(max) not null));
View Linux Static IP
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
View gist:77eca81a1ab4e0f51dea
# Load Assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") >$NULL
# Connect to Tabular SSAS
$srv = New-Object Microsoft.AnalysisServices.Server
$srv.connect("localhost")
# Point to a specific Database
$db = $srv.Databases.FindByName("MyDatabase");
View add-new-tabular-partition
# Load Assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") >$NULL
# Connect to Tabular SSAS
$srv = New-Object Microsoft.AnalysisServices.Server
$srv.connect("localhost\TABULAR")
# Point to a specific Database
$db = $srv.Databases.FindByName("DatabaseName");
View get-wait-stats
if (object_id('tempdb..#t1') is not null) drop table #1
if (object_id('tempdb..#t2') is not null) drop table #2
go
select sample_date = sysdatetime(), * into #t1 from sys.dm_os_wait_stats
waitfor delay '00:00:01'
select sample_date = sysdatetime(), * into #t2 from sys.dm_os_wait_stats
go
select top 25