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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading.Tasks; | |
using MongoDB.Bson; | |
using MongoDB.Driver; | |
using MongoDB.Driver.Builders; |
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.Security.Cryptography; | |
using System.Text; | |
namespace Blockchain | |
{ | |
public class Block | |
{ | |
private DateTime _timestamp; | |
public int Index { get; private set; } |
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 FlightManager | |
{ | |
string _protocol = "rest"; | |
string _format = "json"; | |
string _flightstatusBaseApiUrl; | |
string _flightscheduleBaseApiUrl; | |
public string AppId { get; private set; } | |
public string AppKey { get; private set; } |
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
// https://en.wikipedia.org/wiki/PBKDF2 | |
using Microsoft.AspNetCore.Cryptography.KeyDerivation; | |
using System; | |
using System.Security.Cryptography; | |
namespace Utils | |
{ | |
public class HashUtility | |
{ |
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
let regex; | |
/* matching a specific string */ | |
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello" | |
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO" | |
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes... | |
/* wildcards */ | |
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo" | |
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo" |
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
class Program | |
{ | |
static void Main( string[] args ) | |
{ | |
var to = new MailAddress( <to email here> ); | |
var from = new MailAddress( <from email here> ); | |
var oMail = new MailMessage( from, to ) | |
{ | |
Subject = "test email from office 365 account", |
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
if($args.Count -eq 1) | |
{ | |
$pcname = $args[0] | |
$meminfo = Get-WmiObject CIM_PhysicalMemory -ComputerName $pcname | Measure-Object -Property capacity -sum | % {[math]::round(($_.sum / 1GB),2)} | |
$CPUInfo = (Get-WmiObject Win32_Processor -ComputerName $pcname).Name | |
$OSInfo = (Get-WmiObject Win32_OperatingSystem -ComputerName $pcname).Version | |
Write-Output "CPU -> ""$CPUInfo""" | |
Write-Output "Memory -> ""$meminfo""" | |
Write-Output "OS -> ""$OSInfo""" |
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
namespace ConsoleApp1 | |
{ | |
// 1 gigabyte (GB) = 1073741824 bytes | |
// 2 gigabyte (GB) = 2147483648 bytes | |
class Program | |
{ | |
static void Main( string[] args ) | |
{ | |
//int size = 130000000; // --> 2080000000 bytes |
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.IO; | |
using Newtonsoft.Json; | |
namespace ConsoleApp1 | |
{ | |
/// <summary> | |
/// Example of sum for json array | |
/// </summary> | |
class Program |
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
/* UnitOfWork using example | |
using( var context = new UnitOfWork( "db connection string here" ) ) | |
{ | |
var customer = await context.Use<ICustomerRepository>() | |
.GetBySerial( serial ); | |
} */ | |