Skip to content

Instantly share code, notes, and snippets.

View svaderia's full-sized avatar

Shyamal Vaderia svaderia

View GitHub Profile
'''
A Reccurent Neural Network (LSTM) implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Long Short Term Memory paper: http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
import cv2
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data as input_data
@svaderia
svaderia / python_decorator_guide.md
Created June 27, 2017 19:25 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@svaderia
svaderia / shutil.md
Created June 21, 2017 12:15
shutil module of python
  • shutil.copy()

  • shutil.copytree() #copy whole folder

  • shutil.move() calls says, “Move C:\bacon.txt into the folder C:\eggs.”

    Calling os.unlink(path) will delete the file at path.

    Calling os.rmdir(path) will delete the folder at path. This folder must be empty of any files or folders.

Calling shutil.rmtree(path) will remove the folder at path, and all files and folders it contains will also be deleted.

@svaderia
svaderia / tfbasics.py
Created June 15, 2017 08:11
Basic Tensorflow NN on MNIST dataset
#!/usr/bin/env python
#
# @author : 01110011 01101000 01111001 01100001 01101101 01100001 01101100
# date : 15/06/2017
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

Numpy library provides you with an array data structure that holds some benefits over Python lists, such as: being more compact, faster access in reading and writing items, being more convenient and more efficient. NumPy is a Python library that is the core library for scientific computing in Python. It contains a collection of tools and techniques that can be used to solve on a computer mathematical models of problems in Science and Engineering. One of these tools is a high-performance multidimensional array object that is a powerful data structure for efficient computation of arrays and matrices.

It's a pretty long guide, but covers almost everything you need to know in the beginning about Numpy. So be patient.

@svaderia
svaderia / youtubev.sh
Created April 20, 2017 08:33
Bash script for extracting Video and save it to my Windows Video folder using youtube-dl 😄
#!/bin/bash
youtube-dl -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' -o "/media/shyamal/Windows/Users/Shyamal/Videos/%(uploader)s/-%(title)s.%(ext)s" $1
@svaderia
svaderia / youtube.sh
Last active April 20, 2017 08:32
Bash script for extracting audio and save it to my Windows Music folder using youtube-dl 😎
#!/bin/bash
youtube-dl -x --audio-quality 0 --audio-format "mp3" -o "/media/shyamal/Windows/Users/Shyamal/Music/%(uploader)s/%(title)s.%(ext)s" $1
@svaderia
svaderia / batman.m
Created April 20, 2017 03:32
Gist that plots batman curve in matlab
%Initialization : Clearing workspace
clf; clear all;
syms x y % Specifies that x and y are variables and the equations would be in their terms
%Equations defining the curve
eq1 = ((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+3/7*sqrt(33))/(y+3/7*sqrt(33)))-1);
eq2 = (abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y);
eq3 = (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(x)-y);
eq4 = (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)-.5)))-y);