Skip to content

Instantly share code, notes, and snippets.

View vikene's full-sized avatar
💻
Reduxing 🥇

Vigneash Sundar vikene

💻
Reduxing 🥇
View GitHub Profile
name: Master CI/CD
on:
push:
branches:
- master
jobs:
primary:
runs-on: ubuntu-latest
service: sample-github-actions
provider:
name: aws
runtime: nodejs12.x
stage: dev
region: us-east-1
functions:
app:
@vikene
vikene / app.js
Created April 7, 2020 07:27
sample serverless http lambda function
var express = require('express');
var app = express();
var serverlessHttp = require('serverless-http')
app.get("/", function(req, res){
res.send("HELLO WORLD");
})
module.exports.handler = serverlessHttp(app)
@vikene
vikene / not.py
Created December 20, 2018 02:34
Implementation of OR gate using perceptron
import numpy as np
input1 = [0,0,1,1]
input2 = [1,0,1,0]
truth = [0,1,0,1]
weight1 = 0
weight2 = -1
bias = 0
def perceptron(input1, input2):
@vikene
vikene / and.py
Created December 20, 2018 02:23
Implementation of AND gate using perceptron
import numpy as np
input1 = [0,0,1,1]
input2 = [1,0,1,0]
truth = [0,0,1,0]
weight1 = 1
weight2 = 1
bias = -2
def perceptron(input1, input2):
@vikene
vikene / Dynamic.py
Created November 28, 2018 15:50
Longest Increasing Subsequence
def lis_dp(X):
if not X:
return 0
memo = [1] * len(X)
for i in range(1,len(X)):
for j in range(i):
if X[j] < X[i]:
memo[i] = max(memo[i],memo[j]+1)
return max(memo)
@vikene
vikene / Naive.py
Last active November 28, 2018 01:33
Longest Common Subsequence
def lcs(X,Y, m, n):
if m < 0 or n < 0:
return 0
elif X[m] == Y[n]:
return 1 + lcs(X,Y, m-1,n-1)
else:
return max(lcs(X,Y,m-1,n),lcs(X,Y,m,n-1))
@vikene
vikene / problem_9.py
Created November 27, 2018 21:57
Daily Coding problem #9
def maxCount(arr):
prevMax = 0
currMax = 0
for ar in arr:
temp = currMax
currMax = max(prevMax+ar, currMax)
prevMax = temp
return currMax
@vikene
vikene / package.json
Last active October 15, 2018 00:14
Freecode camp microservices author name package
{
"author": "Vigneash Sundararajan",
"name": "sample",
"version":"0.0.1"
}
import torch
#Creates two tensor objects
#Where X is a simple 1 Dimentional Tensor
#Y is a vector
X = torch.tensor(1.0)
Y = torch.tensor([1.0,2.0])
#Alternatively we can also create a tensor from data like this
Z = torch.tensor([[1.0,2.0,3.0],
[2.0,3.0,4.0],
[3.0,4.0,5.0]])