Skip to content

Instantly share code, notes, and snippets.

View manashmandal's full-sized avatar
👨‍💻
Probably Coding || ! Probably Coding

Manash Kumar Mandal manashmandal

👨‍💻
Probably Coding || ! Probably Coding
View GitHub Profile
from __future__ import print_function
from gensim.models import KeyedVectors
# Creating the model
en_model = KeyedVectors.load_word2vec_format('wiki.en/wiki.en.vec')
# Getting the tokens
words = []
for word in en_model.vocab:
words.append(word)
from __future__ import print_function
from gensim.models import KeyedVectors
import numpy as np
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
# Loading the vectors
## [Warning] Takes a lot of time
en_model = KeyedVectors.load_word2vec_format('wiki.en/wiki.en.vec')
@manashmandal
manashmandal / 0-startup-overview.md
Created March 15, 2017 20:41 — forked from dideler/0-startup-overview.md
Startup Engineering notes
@manashmandal
manashmandal / cylon.js
Last active April 1, 2017 06:47
Arduino Event : Introduction to Arduino & JavaScript
var Cylon = require('cylon');
Cylon.robot({
connections: {
arduino: { adaptor: 'firmata', port: 'COM8' }
},
devices: {
led: { driver: 'led', pin: 13 }
},
from __future__ import print_function
import numpy as np
import tensorflow as tf
sess = tf.Session()
inp = tf.Variable(np.array([0.0, 0.0, 0.0, 0.0, 1.0]).reshape(1, 1, 5, 1), name="inp")
fil = tf.Variable(np.array([0.0, 0.5, 1.0]).reshape(1, 3, 1, 1), name="fil")
op = tf.nn.conv2d(inp, fil, strides=[1, 1, 1, 1], padding='SAME')
@manashmandal
manashmandal / map_data.json
Last active April 20, 2017 06:02
visa refusal data
[{
"country": "eufra",
"name": "France"
}, {
"country": "euprt",
"name": "Portugal"
}, {
"country": "euesp",
"name": "Spain"
}, {
import matplotlib.pyplot as plt
import numpy as np
def likelihood(theta):
return theta**7 * (1 - theta)**3
thetas = np.linspace(0, 1, 100)
L = [likelihood(thetas[i]) for i in range(len(thetas))]
plt.plot(thetas, L)
import matplotlib.pyplot as plt
import numpy as np
def likelihood(theta):
return theta**7 * (1 - theta)**3
thetas = np.linspace(0, 1, 100)
L = [likelihood(thetas[i]) for i in range(len(thetas))]
theta_for_maximum_likelihood = thetas[np.argmax(L)]
@manashmandal
manashmandal / instructions.md
Created June 13, 2017 04:27 — forked from mcescalante/instructions.md
Run a Flask application with gunicorn and nginx

This guide assumes:

  • You have a VPS (something like DigitalOcean, Linode, etc.)
  • You have a Flask application and a basic understanding of command line instructions
  • You've got nginx installed and know where your configuration files are

Instructions

  1. First, you should install gunicorn on your box or virtualenv with pip:
@manashmandal
manashmandal / apl-days.py
Created July 3, 2017 04:23
Generate dates and weekdays excluding weekends
#!/usr/bin/env python
# simply do the following to generate dates for month 12
# curl -s apl-days.py | python - 12 2017
from datetime import date
from calendar import monthrange
from sys import argv
# check if any argument is provided