Skip to content

Instantly share code, notes, and snippets.

View shreybatra's full-sized avatar
🏠
Working from home

Shrey Batra shreybatra

🏠
Working from home
View GitHub Profile
@shreybatra
shreybatra / machine.js
Last active February 24, 2020 12:21
Generated by XState Viz: https://xstate.js.org/viz
const parallelApis = Machine({
id: "Parallel-apis",
type: "parallel",
states: {
userInfo: {
initial: "apiCall",
states: {
apiCall: {
on: {
RESPONSE: "buildUserMap"
@shreybatra
shreybatra / machine.js
Created February 19, 2020 10:48
Generated by XState Viz: https://xstate.js.org/viz
const patientSelectionMachine = Machine({
id: "patientSelector",
initial: "pickPatients",
states: {
pickPatients: {
on: {
FROM_MEASURE: "measure",
FROM_ADT: "activity",
FROM_CSV: "customCsv"
}
import nltk
from nltk.corpus import stopwords
text = "Hi, Laptops from Hewlett-Packard aren't running MacOS. We would love an Apple Mac for our work."
print('Word tokenization - ')
word_token = nltk.word_tokenize(text)
print(word_token)
@shreybatra
shreybatra / blog.py
Last active February 20, 2019 13:21
A sample Flask API to showcase usage of MongoDB in Python
from flask import Flask, request,jsonify
from pymongo import MongoClient
from bson.objectid import ObjectId
from datetime import datetime
app = Flask(__name__)
client = MongoClient()
db = client.blogdb
blogs = db.blogs
@shreybatra
shreybatra / snakecoin-server-full-code.py
Created November 11, 2018 07:04 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
@shreybatra
shreybatra / car.py
Last active March 19, 2018 17:48
MongoDB connection in Flask
'''
This code is a sample code written to explain MongoDB and how to integrate it in Flask.
For full blog visit - http://www.eazydevelop.com/2018/03/mongodb-and-integration-with-flask.html
'''
from flask import Flask, request, jsonify
from pymongo import MongoClient
import pymongo