Skip to content

Instantly share code, notes, and snippets.

@vainolo
vainolo / Method2.cs
Last active February 23, 2021 22:43
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"))
{
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 November 21, 2018 19:08
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 4
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 November 21, 2018 13:46
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 3
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 November 21, 2018 13:46
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 2
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 November 21, 2018 12:33
Azure Functions – Part 7: Blob, Queue, and Cosmos DB Triggers - 1
{
"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 November 18, 2018 19:56
Azure Functions – Part 6: HTTP and Timer Triggers - 3
// 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 November 14, 2018 20:57
Azure Functions – Part 6: Triggers and Bindings - 2
[FunctionName("NoTrigger")]
public static void NoTrigger(ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
}
@vainolo
vainolo / afp6_1.cs
Last active November 14, 2018 20:55
Azure Functions – Part 6: Triggers and Bindings - 1
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 November 8, 2018 20:56
Azure Functions - Part 5: Deploying to Azure from VSCode - 2
{
"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"
}
}