Skip to content

Instantly share code, notes, and snippets.

View svaderia's full-sized avatar

Shyamal Vaderia svaderia

View GitHub Profile
@svaderia
svaderia / tree.md
Created September 23, 2017 09:50 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@svaderia
svaderia / percolation.py
Created August 22, 2017 13:51 — forked from cameronneylon/percolation.py
Code for percolation network simulation used in my talk at #BOSC July 19 2013 in Berlin. Based on code from http://dragly.org/2013/03/25/working-with-percolation-clusters-in-python/. The license for the source code is not entirely clear so this code is made available under a CC BY-SA license as per the blog it was derived from. For reasons not e…
from pylab import *
from scipy.ndimage import measurements
import numpy as np
import matplotlib.pyplot as plt
import time
import sys
import signal
def signal_handler(signal, frame):
sys.exit(0)
@svaderia
svaderia / GitHub-Forking.md
Created August 5, 2017 16:31 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@svaderia
svaderia / gist:283d5a322fcd98bc9d89e8aa244bd085
Last active August 5, 2017 18:11 — forked from ttezel/gist:4138642
Natural Language Processing Notes

A Collection of NLP notes

N-grams

Calculating unigram probabilities:

P( wi ) = count ( wi ) ) / count ( total number of words )

In english..

@svaderia
svaderia / cp_syllabus.md
Created August 5, 2017 16:29 — forked from sharmaeklavya2/cp_syllabus.md
Competitive Programming Syllabus

Competitive Programming Syllabus

Geometry

  • Problems - Refer the article for a list of problems which can be solved using Rotating Calipers technique.
@svaderia
svaderia / char-rnn recipes.md
Created July 21, 2017 19:01 — forked from nylki/char-rnn recipes.md
char-rnn cooking recipes

do androids dream of cooking?

The following recipes are sampled from a trained neural net. You can find the repo to train your own neural net here: https://github.com/karpathy/char-rnn Thanks to Andrej Karpathy for the great code! It's really easy to setup.

The recipes I used for training the char-rnn are from a recipe collection called ffts.com And here is the actual zipped data (uncompressed ~35 MB) I used for training. The ZIP is also archived @ archive.org in case the original links becomes invalid in the future.

In this gist I'm going to list all the concept I need to learn for starting with tensorflow. This list is being made while reading official documentation.

  1. Install
  2. Tensor
  3. Computational graph
  4. tf.Session()
  5. tf.constant()
  6. tf.placeholder()
  7. sess.run( , feed_dict = { } )
@svaderia
svaderia / DNN_MNIST.py
Created July 3, 2017 12:40 — forked from Shephexd/DNN_MNIST.py
Tensorflow
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
x = tf.placeholder("float", [None, 784]) #mnist data image of shape 28*28*784
y = tf.placeholder("float", [None, 10]) #0-9 digits recognition
#Create model
import cv2
import numpy as np
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data as input_data
def init_weights(shape):
return tf.Variable(tf.random_normal(shape, stddev=0.01))
def model(X, w_h, w_o):