Skip to content

Instantly share code, notes, and snippets.

View StefH's full-sized avatar

Stef Heyenrath StefH

View GitHub Profile
@StefH
StefH / AzureFunctionExecuteFunction.cs
Last active September 10, 2019 17:21
AzureFunctionExecuteFunction.cs
[FunctionName("ExecuteSmartContractFunction")]
public async Task<IActionResult> RunExecuteFunctionAsync(
[HttpTrigger(AuthorizationLevel.Function, "post")]HttpRequest req)
{
_logger.LogInformation("ExecuteSmartContractFunction");
string body = await req.ReadAsStringAsync();
var request = JsonConvert.DeserializeObject<SmartContractFunctionRequest>(body);
try
@StefH
StefH / AzureFunctionQueryFunction.cs
Last active September 10, 2019 17:21
AzureFunction QueryFunction
[FunctionName("QuerySmartContractFunction")]
public static async Task<IActionResult> RunQueryFunctionAsync(
[HttpTrigger(AuthorizationLevel.Function, "post")]HttpRequest req,
[Inject] ISmartContractService service,
ILogger logger)
{
_logger.LogInformation("QuerySmartContractFunction");
string body = await req.ReadAsStringAsync();
var request = JsonConvert.DeserializeObject<SmartContractFunctionRequest>(body);
@StefH
StefH / AzureFunctionDeploySmartContract.cs
Last active September 10, 2019 17:21
AzureFunction DeploySmartContract
[FunctionName("QuerySmartContractFunction")]
public async Task<IActionResult> RunQueryFunctionAsync(
[HttpTrigger(AuthorizationLevel.Function, "post")]HttpRequest req)
{
_logger.LogInformation("RunDeployContract");
string body = await req.ReadAsStringAsync();
var request = JsonConvert.DeserializeObject<SmartContractDeployRequest>(body);
try
@StefH
StefH / SimpleStorageContract.sol
Created May 22, 2019 05:54
SimpleStorage SmartContract
pragma solidity >=0.5.2 <0.6.0;
contract SimpleStorageContract {
int private _version;
string private _description;
uint private _storedNumber;
string private _storedString;
constructor (int version, string memory description) public {
@StefH
StefH / SoapUI_hmac_sha256.groovy
Created April 5, 2019 06:13
SoapUI hmac_sha256 code to create a SAS SharedAccessSignature for Azure Service Bus Queue
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
def hmac_sha256(String secretKey, String data) {
def mac = Mac.getInstance("HmacSHA256");
def secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
mac.init(secretKeySpec);
return mac.doFinal(data.getBytes());
using Microsoft.Extensions.Options;
using System;
using System.Configuration;
using System.Linq;
using System.Reflection;
namespace ConsoleApp
{
public static class OptionsBuilderExtensions
{
@StefH
StefH / AutoMapperExtensions.cs
Created December 30, 2018 18:25
AutoMapper Extensions : Unflatten
using System;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
// ReSharper disable once CheckNamespace
namespace AutoMapper
{
public static class AutoMapperExtensions
{
# Build source, tests and run tests with coverage
- script: |
dotnet test ./test/MyTestProject.csproj -c Debug --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
displayName: 'Build source, tests and run tests with coverage'
# Upload coverage to codecov.io
- script: |
%USERPROFILE%\.nuget\packages\codecov\1.1.0\tools\codecov.exe -f "./test/MyTestProject/coverage.opencover.xml" -t $(CODECOV_TOKEN)
displayName: Upload coverage to codecov.io
<ItemGroup>
<PackageReference Include="Codecov" Version="1.1.0" />
<!-- more pacakges here ... -->
</ItemGroup>
apiVersion: v1
kind: Service
metadata:
name: default-subdomain
spec:
selector:
name: busybox
clusterIP: None
ports:
- name: foo # Actually, no port is needed.