Skip to content

Instantly share code, notes, and snippets.

View prashantgpt91's full-sized avatar
🎯
Focusing

Prashant Gupta prashantgpt91

🎯
Focusing
View GitHub Profile
//
// main.cpp
// dp
//
// Created by Prashant on 4/16/18.
// Copyright © 2018 Prashant. All rights reserved.
//
#include <iostream>
using namespace std;
{
"directed": false,
"multigraph": false,
"graph": {
"node_default": {},
"edge_default": {}
},
"nodes": [
{
"vul": "execCode(workStation,root)",
from utilities import load_data,cross_validate
from utilities import DataClean
from sklearn.naive_bayes import BernoulliNB
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.pipeline import Pipeline
from sklearn.metrics import accuracy_score
if __name__ == '__main__':
@prashantgpt91
prashantgpt91 / calculate_sentiment_from_dictionary.py
Last active March 14, 2018 09:53
Simple dictionary based approach from Sentiment Analysis
from utilities import load_data,cross_validate
from utilities import DataClean
from sklearn.pipeline import Pipeline
from sklearn.metrics import accuracy_score
from pprint import pprint
from math import floor
class DictSimple:
def __init__(self):
Label 1 : +ve review
stuff going moment mj ve started listening music watching odd documentary watched wiz watched moonwalker maybe want get certain insight guy thought really cool eighties maybe make mind whether guilty innocent moonwalker part biography part feature remember going see cinema originally released subtle messages mj feeling towards press also obvious message drugs
bad kay visually impressive course michael jackson unless remotely like mj anyway going hate find boring may call mj egotist consenting making mj fans would say made fans true really nice actual feature bit finally starts minutes excluding smooth criminal sequence joe pesci convincing psychopathic powerful drug lord wants mj dead bad beyond mj
overheard plans nah joe pesci character ranted wanted people know supplying drugs etc dunno maybe hates mj music lots cool things like mj turning car robot whole speed demon sequence also director must patience saint came filming kiddy bad sequence usually directors hate working one kid let a
Label 0 : -ve review
starts manager nicholas bell giving welcome investors robert carradine primal park secret project mutating primal animal using fossilized dna like jurassik park scientists resurrect one nature fearsome predators sabretooth tiger smilodon scientific ambition turns deadly however high voltage fence opened creature escape begins savagely stalking prey human
visitors tourists scientific meanwhile youngsters enter restricted area security center attacked pack large pre historical animals deadlier bigger addition security agent stacy haiduk mate brian wimmer fight hardly carnivorous smilodons sabretooths course real star stars astounding terrifyingly though convincing giant animals savagely
stalking prey group run afoul fight one nature fearsome predators furthermore third sabretooth dangerous slow stalks victims delivers goods lots blood gore beheading hair raising chills full scares sabretooths appear mediocre special effects story provides exciting stirring entertainment results quite bo
#!/usr/bin/env python
from os import path
from wordcloud import WordCloud
d = path.dirname(__file__)
# Read the whole text.
text = open(path.join(d, 'adult.txt')).read()
wrk -t12 -c400 -d20s -s post.lua http://XX.XXX.XX.XX/v1/ABCD
@prashantgpt91
prashantgpt91 / post.lua
Created March 8, 2018 09:27
posting JSON data to an API - used to benchmark using wrk
wrk.method = "POST"
wrk.body = '{"data": "Feb 21 11:26:56 ip-172-30-2-108 sshd[1714]: pam_unix(sshd:session): session opened for user ubuntu by (uid=0)"}'
wrk.headers["Content-Type"] = "application/json"
@prashantgpt91
prashantgpt91 / flask+uwsgi+nginx.md
Last active March 9, 2018 06:35
How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04

Introduction

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions, it can help you get your Python application or website off the ground. Flask includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server is required.

In this guide, we will demonstrate how to install and configure some components on Ubuntu 14.04 to support and serve Flask applications. We will configure the uWSGI application container server to interface with our applications. We will then set up Nginx to reverse proxy to uWSGI, giving us access to its security and performance features to serve our apps.

Prerequisites and Goals

In order to complete this guide, you should have a fresh Ubuntu 14.04 server instance with a non-root user with sudo privileges configured.