Skip to content

Instantly share code, notes, and snippets.

View Method2.cs
public static void Scrape()
{
var scraper = new HtmlWeb();
var page = scraper.Load("https://vainolo.z14.web.core.windows.net/WebScraping.html");
var nodes = page.DocumentNode.Descendants().SkipWhile(e => e.Id != "Techniques").Skip(1).TakeWhile(e => e.Name != "h2");
foreach (var currNode in nodes)
{
if(currNode.GetClasses().Contains("mw-headline"))
{
View Method1.cs
public static void Scrape()
{
var scraper = new HtmlWeb();
var page = scraper.Load("https://vainolo.z14.web.core.windows.net/WebScraping.html");
var techniquesTitle = page.GetElementbyId("Techniques");
var currNode = techniquesTitle.ParentNode.NextSibling;
while(currNode.Name != "h2")
{
if(currNode.GetClasses().Contains("mw-headline"))
{
@vainolo
vainolo / afp7_4.cs
Created Nov 21, 2018
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 4
View afp7_4.cs
using System.Collections.Generic;
using Microsoft.Azure.Documents;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace Company.Function
{
public static class CosmosDBTriggerCSharp
{
@vainolo
vainolo / afp7_3.cs
Created Nov 21, 2018
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 3
View afp7_3.cs
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace Vainolo.AzureFunctionsTutorial.Part7
{
public static class QueueTriggerCSharp
{
[FunctionName("QueueTriggerCSharp")]
@vainolo
vainolo / afp7_2.cs
Last active Nov 21, 2018
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 2
View afp7_2.cs
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace Vainolo.AzureFunctionsTutorial.Part7
{
public static class BlobTriggerCSharp
{
[FunctionName("BlobTriggerCSharp")]
@vainolo
vainolo / afp7_1.json
Last active Nov 21, 2018
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 1
View afp7_1.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"MyStorage": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;",
"MyCosmosDB": "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
}
}
@vainolo
vainolo / afp6_3.cs
Last active Nov 18, 2018
Azure Functions – Part 6: HTTP and Timer Triggers - 3
View afp6_3.cs
// CRON formatted trigger every 5 seconds
[FunctionName("TimerTrigger1")]
public static void TimerTrigger1([TimerTrigger("*/5 * * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"CRON trigger executed at : {DateTime.Now}");
}
[FunctionName("TimerTrigger2")]
public static void TimerTrigger2([TimerTrigger("00:00:03")]TimerInfo myTimer, ILogger log)
{
@vainolo
vainolo / afp6_2.cs
Created Nov 14, 2018
Azure Functions – Part 6: Triggers and Bindings - 2
View afp6_2.cs
[FunctionName("NoTrigger")]
public static void NoTrigger(ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
}
@vainolo
vainolo / afp6_1.cs
Last active Nov 14, 2018
Azure Functions – Part 6: Triggers and Bindings - 1
View afp6_1.cs
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
@vainolo
vainolo / afp5_2.json
Last active Nov 8, 2018
Azure Functions - Part 5: Deploying to Azure from VSCode - 2
View afp5_2.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;",
"MyStorageAccount": "AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;DefaultEndpointsProtocol=http;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}