Skip to content

Instantly share code, notes, and snippets.

Start server: cd my-app; ng serve
Start New component:
ng generate component <name>
@shilpavijay
shilpavijay / funcpool.py
Created March 15, 2018 08:48
MThMTasking - push
from multiprocessing import Pool
import threading
import timeit
def func(x): return x**1000
#multiprocessing
start = timeit.timeit()
p = Pool(4)
print(p.map(func,[2,4,6,8]))
@shilpavijay
shilpavijay / tasks.py
Created March 15, 2018 08:47
Celery-push
from celery import Celery, shared_task
import time
#Redis Result backend config:
app = Celery('tasks', broker='amqp://localhost//', backend='redis://localhost:6379/0')
#Mysql Result backend config:
# app = Celery('tasks', broker='amqp://localhost//', backend='db+mysql://root:python098@localhost/test')
Starting nginx
docker run -d -p 80:80 --name webserver nginx
docker images
docker ps -a
remove images:
---------------
docker rmi <>
@shilpavijay
shilpavijay / No_of_Road_Acc.csv
Last active February 23, 2018 11:00
GeoJSON - GovData
States 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
Andhra Pradesh 9800 10981 10026 10953 9979 10634 9887 10681 11211 8353 9621 9267 9134 9729
Arunachal Pradesh 144 84 111 82 88 115 114 128 0 0 0 0 0 75
Assam 784 746 947 946 1010 849 1034 1345 1552 1553 1817 1777 1898 1999
Bihar 1493 1195 1076 1702 1971 1499 2719 2837 3177 2833 2837 2535 3255 2434
Chhattisgarh 2593 2837 3543 3356 3265 3814 3564 3363 3156 3654 3804 3758 3898 3164
Goa 356 323 400 421 536 610 787 925 675 654 422 434 451 356
Gujarat 10242 10229 10133 9071 9630 10167 9210 9177 9252 8188 7731 7437 6739 6309
Haryana 2529 2931 2917 3202 3752 3611 3693 3436 3425 3108 3253 3247 3389 2887
Himachal Pradesh 699 816 787 792 845 597 806 703 742 533 643 698 634 820
@shilpavijay
shilpavijay / New Project: super-quiz
Last active February 14, 2018 10:35
Vue as on 14feb
Index.html
----------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue Animations</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
@shilpavijay
shilpavijay / frozen flask for MDW
Last active February 7, 2018 04:22
Frozen flask
to install:
Frozen-Flask
to run:
python <pyfilename> build
import sys
from flask import Flask
from flask import render_template
import pandas as pd
@shilpavijay
shilpavijay / ML quick finds
Last active February 13, 2018 09:30
Deep learning
Sigmoid function:
sigmoid(x) = 1/(1+e^-x)
A sigmoid function is a mathematical function having a characteristic "S"-shaped curve or sigmoid curve.
Softmax:
The softmax function is often used in the final layer of a neural network-based classifier. Such networks are commonly trained
under a log loss (or cross-entropy) regime, giving a non-linear variant of multinomial logistic regression.
W -> Vector representing weight (that represented on the line btw input(x) and first activation layer(z))
b -> bias (each activation layer(z) has a bias term)
#If this is set to True, the axes which are reduced are left in the result as dimensions with size one
<np array>.sum(axis=1, keepdims=True)
np.vstack - stack array row-wise
#Convert to NP Array:
df = pd.read_csv(csvfile)
nparr = np.array(df)
#finding max of a dataframe
var h = 500;
var w = 800;
var svg = d3.select("body").append("svg")
.attr("id","chart")
.attr("width",w)
.attr("height",h);
var num = 51;
var types = 4;