Skip to content

Instantly share code, notes, and snippets.

View PradeepLoganathan's full-sized avatar

Pradeep Loganathan PradeepLoganathan

View GitHub Profile
@PradeepLoganathan
PradeepLoganathan / simplecloudformationtemplate.yml
Last active August 6, 2019 23:31
A very simple cloudformation tempalte to create an s3 bucket.
Resources:
MyS3Bucket:
Type: AWS::S3::Bucket
Outputs:
BucketName:
Value:
Ref: MyS3Bucket
{
"AWSTemplateFormatVersion" : "version date",
"Description" : "Description",
"Resources" : { },
"Parameters" : { },
"Mappings" : { },
"Conditions" : { },
"Metadata" : { },
"Outputs" : { }
}
@PradeepLoganathan
PradeepLoganathan / poddef.json
Created January 13, 2019 03:57
pod definition - Yaml definition of a pod.
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"creationTimestamp": "2019-01-12T18:19:02Z",
"generateName": "docone-deployment3-6594cdc4d-",
"labels": {
"pod-template-hash": "6594cdc4d",
"run": "docone-deployment3"
},
@PradeepLoganathan
PradeepLoganathan / Eventschema.json
Created December 30, 2018 10:55
Azure event grid - Event Schema
[
{
"topic": "string",
"subject": "string",
"id": "string",
"eventType": "string",
"eventTime": "string",
"data": { "object-unique-to-each-publisher" },
"dataVersion": "string",
"metadataVersion": "string"
@PradeepLoganathan
PradeepLoganathan / AzureEventGridEventHandler.cs
Last active December 31, 2018 13:38
Azure Event grid - Custom event handler
public async Task<IActionResult> Post([FromBody]object request)
{
try
{
var eventGridEvent = JsonConvert.DeserializeObject<EventGridEvent[]>(request.ToString());
foreach (var item in eventGridEvent)
{
if (string.Equals(item.EventType, "Microsoft.EventGrid.SubscriptionValidationEvent", StringComparison.OrdinalIgnoreCase))
@PradeepLoganathan
PradeepLoganathan / CandidateEvent.cs
Created December 30, 2018 10:10
Azure Event grid - Domain Event
public class CandidateEvents : ICandidateEvents
{
string topicEndpoint;
string topicKey ;
string topicHostname ;
TopicCredentials topicCredentials ;
EventGridClient client;
public CandidateEvents()
{
@PradeepLoganathan
PradeepLoganathan / ICandidateEvents.cs
Created December 30, 2018 09:51
Event Grid - Event Interface
public interface ICandidateEvents
{
Task CandidateCreatedEvent(Candidate candidate);
Task CandidateUpdatedEvent(Candidate candidate);
}
@PradeepLoganathan
PradeepLoganathan / Dockerfile
Created August 24, 2018 08:05
Simple dockerfile for a console application
FROM microsoft/dotnet:2.1-runtime AS base
WORKDIR /app
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY thetime/thetime.csproj thetime/
RUN dotnet restore thetime/thetime.csproj
COPY . .
WORKDIR /src/thetime
RUN dotnet build thetime.csproj -c Release -o /app
@PradeepLoganathan
PradeepLoganathan / thetime.cs
Created August 24, 2018 07:51
A console timer sample
using System;
using System.Timers;
namespace thetime
{
class Program
{
static void Main(string[] args)
{
var timer = new Timer(2000);
@PradeepLoganathan
PradeepLoganathan / AuthGuard.ts
Created May 19, 2018 12:03
Code to call the TokenService and store the token
this.tokenizerService.getToken().subscribe(
(data) => {
console.log(`token is ${data}`);
localStorage.setItem("token", data.token)
localStorage.setItem("tokenexpiration", data.expiration)
},
error => {
console.log(`Error in obtaining token ${error}`);
}