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 TokenValidationHandler | |
{ | |
private static JwtOptions _jwtOptions; | |
public static void CofigureTokenvalidationMiddleware(IApplicationBuilder app, JwtOptions jwtOptions) | |
{ | |
_jwtOptions = jwtOptions ?? throw new ArgumentNullException(nameof(jwtOptions)); | |
app.UseMiddleware<TokenValidationMiddleware>(); | |
} |
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 static partial class TokenFactory | |
{ | |
public static async Task<TokenReponse> Connect(HttpContext ctx, JwtOptions jwtOptions) | |
{ | |
// validates the content type of the request | |
var userName = await ValidateRequestCtx(ctx, jwtOptions); | |
// get user roles & permissions | |
UserRepo repo = new(); // this is a mock repo for the sake of the example |
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
$SourceServer = "tcp:servername-s1.database.windows.net" | |
$SourceUserName = "username-u1@servername-s1" | |
$SourcePassword = "password-p1" | |
$TargetServer = "tcp:servername-s2.database.windows.net" | |
$TargetUserName = "username-u2@servername-s2" | |
$TargetPassword = "password-p2" | |
$database = "database-name" # Kept same for simplicity. | |
$bckDirectory = "D:\DataMigration\" |
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
async function InitSync() { | |
var remote, repo, count, fileNames, fileContent; | |
nodegit.Repository.open(repoFolder) | |
.then(function (repoResult) { | |
repo = repoResult | |
count = 0; | |
fileNames = []; | |
fileContent = {}; |
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
async function CloneRepo() { | |
var cloneOptions = { | |
fetchOpts: { callbacks: credentialsCallback } | |
}; | |
nodegit.Clone(url, dir, cloneOptions).then(function (repo) { | |
debug.verbose("Cloned " + path.basename(url) + " to " + repo.workdir()); | |
}).catch(function (err) { | |
debug.verbose(err); | |
}); | |
} |
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 config = { | |
"options": { | |
"privateKey": "<pathToPrivateKey>/MyKeyFile", | |
"publicKey": "<pathToPublicKey>/MyKeyFile.pub", | |
"passphrase": "Y0ur.P@5$p#rAse.G0e5.H3rE!", | |
"twoWaySync": true, | |
"sshUrl": "<get_this_sshUrl_from_git>", | |
"signature_name": "Someone's Name", | |
"signature_email": "SomeoneWho@isMakingThisCommit.dev" |
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 debug = ""; //Import your Logger here or use Console just in case. | |
const nodegit = require("nodegit"); | |
const fs = require('fs'); | |
const path = require("path"); | |
const fse = require("fs-extra"); | |
const dir = `./backup/` | |
const repoFolder = `${dir}.git`; | |
var privateKey, publicKey, passphrase, twoWaySync, url, credentialsCallback, signature_name, signature_email; |
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 Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using Microsoft.Extensions.Logging; | |
using System; | |
using System.Diagnostics; | |
using System.Threading.Tasks; | |
namespace execFuncApp |
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
Add-Type -outputtype consoleapplication -outputassembly helloworld.exe 'public class helloworld{public static void Main(){System.Console.WriteLine("hello world");}}' |
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 file_url = 'https://downloadurl.com/files/my_zip_file.zip'; | |
var AdmZip = require('adm-zip'); //Reference: https://www.npmjs.com/package/adm-zip | |
var https = require('https'); | |
var fs = require('fs') | |
https.get(file_url, function (res) { | |
var data = [], dataLen = 0; | |
res.on('data', function (chunk) { |
NewerOlder