This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class APIKeyMessageHandler : DelegatingHandler | |
{ | |
private const string APIKey = "ZG95b3Vrbm93dGhhdGFjZXJpc3RoZWJlc3Rjb21wYW55aW50aGV3b3JsZGJ5YW5keQ=="; | |
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
bool validKey = false; | |
IEnumerable<string> requestHeaders; | |
var checkApiKeyExists = request.Headers.TryGetValues("MyAPIKey", out requestHeaders); | |
if (checkApiKeyExists) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VM_PATH='C:\Users\andy5100\Documents\export\ubuntu\ubuntu-pure\Virtual Machines\1B241D9D-7353-4977-B759-F7E0C1A126DC.vmcx' | |
$VM_DEST_MASTER='C:\Users\andy5100\Documents\k8s2\master' | |
$VM_DEST_NODE1='C:\Users\andy5100\Documents\k8s2\node1' | |
$VM_DEST_NODE2='C:\Users\andy5100\Documents\k8s2\node2' | |
$VM_DEST_LIST=@($VM_DEST_MASTER, $VM_DEST_NODE1, $VM_DEST_NODE2) | |
foreach ( $DEST in $VM_DEST_LIST) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sql = require('mssql') | |
const config = { | |
user: '', | |
password: '', | |
server: '', // You can use 'localhost\\instance' to connect to named instance | |
database: '', | |
options: { | |
encrypt: true // Use this if you're on Windows Azure | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sklearn.feature_extraction.text import CountVectorizer | |
corpus = ['The cat sat on the mat', 'The dog sat on the mat', 'The goat sat on the mat'] | |
vectorizer = CountVectorizer(lowercase=True, analyzer='word', binary=False) | |
representation = vectorizer.fit_transform(corpus) | |
representation_df = pd.DataFrame(data = representation.toarray(), columns=sorted(vectorizer.vocabulary_.keys())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-RandomFilename { | |
[IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetRandomFileName() ) | |
} | |
Get-RandomFilename | |
# Result ------------------------------ | |
# PS C:\Windows\system32> Get-RandomFilename | |
# cbzivvcs | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$appUserPWD= $(az webapp deployment list-publishing-profiles --name $appname --resource-group $resouceGroup --query '[0].{userPWD:userPWD,userName:userName}' -o json | ConvertFrom-Json ) | |
$appUserPWD | |
$appUserPWD.userPWD | |
# Result > | |
# PS C:\Windows\system32> $appUserPWD | |
# | |
# userName userPWD | |
# -------- ------- | |
# $webSite-botapp-123fz3m6x4 hm7lwb8rqpARtLki9uz5Thx6oFadERGWaX1vgjXQ1eyCrdT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const testFolder = './tests/'; | |
const fs = require('fs'); | |
fs.readdirSync(testFolder).forEach(file => { | |
console.log(file); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var azure = require('azure-storage'); | |
var blobService = azure.createBlobService("andytestapp", | |
"5gs4i123123adasd23423423412312323423424234234234234Mg=="); | |
module.exports = { | |
createContainerIfNotExists(containerName) { | |
return new Promise(function(resolve, reject) { | |
blobService.createContainerIfNotExists(containerName, { | |
publicAccessLevel: 'blob' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Security.Cryptography; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
byte[] SHA256Data = Encoding.UTF8.GetBytes("12345678"); | |
SHA256Managed Sha256 = new SHA256Managed(); | |
byte[] Result = Sha256.ComputeHash(SHA256Data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.Linq.Expressions; | |
using System.Windows; | |
using System.Windows.Input; | |
namespace HeiswayiNrird.MVVM.Common | |
{ |