Skip to content

Instantly share code, notes, and snippets.

View ManivannanMurugavel's full-sized avatar
😝
less theory more code

ManivannanMurugavel ManivannanMurugavel

😝
less theory more code
View GitHub Profile
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Welcome to Golab REST API"
if __name__ == '__main__':
app.run()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from ctypes import *
import math
import random
import numpy as np
from numpy.linalg import norm
import cv2
def sample(probs):
s = sum(probs)
from ctypes import *
import math
import random
import numpy as np
from numpy.linalg import norm
import cv2
def sample(probs):
s = sum(probs)
import spacy
import random
TRAIN_DATA = [('what is the price of polo?', {'entities': [(21, 25, 'PrdName')]}),
('what is the price of ball?', {'entities': [(21, 25, 'PrdName')]}),
('what is the price of jegging?', {'entities': [(21, 28, 'PrdName')]}),
('what is the price of t-shirt?', {'entities': [(21, 28, 'PrdName')]}),
('what is the price of jeans?', {'entities': [(21, 26, 'PrdName')]}),
('what is the price of bat?', {'entities': [(21, 24, 'PrdName')]}),
import numpy as np
a = np.array([6,0])
b = np.array([0,0])
c = np.array([0,6])
ba = a - b
bc = c - b
cosine_angle = np.dot(ba, bc) / (np.linalg.norm(ba) * np.linalg.norm(bc))
import math
def getAngle(a, b, c):
ang = math.degrees(math.atan2(c[1]-b[1], c[0]-b[0]) - math.atan2(a[1]-b[1], a[0]-b[0]))
return ang + 360 if ang < 0 else ang
print(getAngle((5, 0), (0, 0), (0, 5)))
<?php
$myfile = fopen("newfile.txt", "r") or die("Unable to open file!");
$email = fread($myfile,filesize("newfile.txt"));
fclose($myfile);
$myObj->name = "Manivannan";
$myObj->username = "Manivannan";
$myObj->email = $email;
$myJSON = json_encode($myObj);
echo $myJSON;
?>
<?php
$myObj->access_token = "d50d9fd00acf797ac409d5890fcc76669b727e63";
$myObj->token_type = "Bearer";
$myObj->expiry_in = "1295998";
$myObj->refresh_token="TZzj2yvtWlNP6BvG6UC5UKHXY2Ey6eEo80FSYax6Yv8";
$myJSON = json_encode($myObj);
echo $myJSON;
?>
@ManivannanMurugavel
ManivannanMurugavel / index.php
Created March 10, 2019 07:04
Generic grafana oauth login athentication page
<?php
$state = $_GET['state'];
$state = urlencode($state);
$url = "http://localhost:3000/login/generic_oauth?state=".$state."&code=cc536d98d27750394a87ab9d057016e636a8ac31";
$user_email = $_COOKIE["user_email"];
if($user_email != "")
{
$myfile = fopen("userinfo/newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, $user_email);
fclose($myfile);