Skip to content

Instantly share code, notes, and snippets.

View sachinsu's full-sized avatar

Sachin Sunkle sachinsu

View GitHub Profile
@sachinsu
sachinsu / Backgroundworker.cs
Created March 21, 2023 09:07
Asynchronous task scheduling (Queuing) in Web API
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Channels;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Hosting;
namespace apiwithqueue.hostedservice {
public class QueuedHostedService : BackgroundService
@sachinsu
sachinsu / Tls_using_bc.cs
Last active March 1, 2023 12:19
TLS using BouncyCastle library
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using Org.BouncyCastle.Tls.Crypto.Impl.BC;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Tls;
class CustomTlsClient : DefaultTlsClient
@sachinsu
sachinsu / extensions.cs
Created August 27, 2020 07:20
Retrying while Opening connection to Oracle Database using Polly
using System;
using Oracle.ManagedDataAccess.Client;
using Polly;
namespace frontend.ExtensionMethods
{
public static class Extensions
{
const int retryTimes = 3;
@sachinsu
sachinsu / build.yml
Created May 29, 2020 07:04
Github Workflow to build Quasar based Application and deploy to Netlify
on:
push:
branches:
- master
env:
NODE_VERSION: '12.x' # set this to the node version to use
jobs:
build-and-deploy:
@sachinsu
sachinsu / Card.cs
Created May 5, 2020 06:18
Using BenchmarkDotNET to benchmark File Generation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bogus;
namespace CSVGeneration
{
public class Card
@sachinsu
sachinsu / Program.cs
Created April 23, 2020 06:52
Windows Service using Topshelf with Cancellable Task
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Topshelf;
using NLog;
namespace ListenerService
@sachinsu
sachinsu / main.go
Last active February 21, 2020 11:06
Web server as system daemon (Windows Service/Systemd) in Go
package main
import (
"context"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
@sachinsu
sachinsu / EventConsumer.cs
Created February 14, 2020 04:58
Using System.Threading.channels for implementing High performance Producer-Consumer Pattern
using System;
using System.Collections.Generic;
using System.Threading.Channels;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace channels
@sachinsu
sachinsu / goqueue.go
Last active February 13, 2020 08:26
Using Go Routines to evaluate Oracle Advance Queuing Support using godror library
package main
import (
"context"
"database/sql"
"fmt"
"strings"
"time"
godror "github.com/godror/godror"
@sachinsu
sachinsu / OpenFaasOnWindows
Last active February 25, 2019 05:20
Run OpenFaas on Windows 10 Home Edition with Minikube and Virtualbox
# Install Virtualbox (from here)[https://www.virtualbox.org/wiki/Downloads]
# Install Kubectl, refer (here)[https://kubernetes.io/docs/tasks/tools/install-minikube/#install-kubectl]
# Install Minikube, refere (here)[https://kubernetes.io/docs/tasks/tools/install-minikube/#install-minikube)
# Install Helm by following instructions at (Helm)[https://github.com/helm/helm/blob/master/docs/install.md]
# Install faas-cli, refer (here)[https://docs.openfaas.com/cli/install/]
# Start Windows Powershell using Run as Administrator
# Update Path variable by adding paths to above utilities using `$env:Path += "c:\path_to_kubectl"`
# Run `minikube start` - This will download VM image and set it up in Virtualbox and kick off K8s Cluster.
# Run `& minikube docker-env | Invoke-Expression` - This means that any Docker images built will be built in your minikube, so they are readily available.
# clond faas-netes repository using `git clone https://github.com/openfaas/faas-netes.git`.