Skip to content

Instantly share code, notes, and snippets.

View Spandyie's full-sized avatar
:octocat:

Spandan Mishra Spandyie

:octocat:
  • Palo Alto Networks
  • San Francisco
  • X @spandyie
View GitHub Profile
@Spandyie
Spandyie / ParticleFilter.py
Created October 11, 2019 03:31
Python code for Particle filter
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 11 00:02:58 2019
@author: spandan
"""
# Please only modify the indicated area below!
@Spandyie
Spandyie / splitString.cpp
Created July 25, 2019 00:13
C++ with takes a string and splits it based on the delimiter character and returns it in vector
#include <vector>
template<typename Out>
void split(std::string& s, char delim, Out result) {
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim)) {
*(result++) = item;
#include <vector>
#include <numeric>
#include <fstream>
#include <iterator>
#include <algorithm>
template<typename T>
class FindPeaks{
private:
std::vector<T> m_input_signal; // stores input vector
@Spandyie
Spandyie / DG.txt
Created December 23, 2018 03:53
Given a set of job represented by set of nodes, with precedance constraint that specify that certain jobs to be completed before certain jobs are begun, topographical sorting which is based on depth first search gives the schedule of the jobs while respecting all the constraint.
13
0,1
0,6
0,5
2,0
2,3
5,4
6,4
6,9
7,6
@hiepph
hiepph / cifar10.py
Last active April 18, 2018 01:46
CIFAR 10 (small images dataset) using Deep CNN with help of Keras x Tensorflow
from __future__ import print_function
import os
import _pickle as pickle
import numpy as np
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential, load_model
@yaroslavvb
yaroslavvb / gist:b73ff35424dd7ab762234620cf583aac
Created September 16, 2016 23:08
Example of restricting part of graph to run on single core
# try running cpu intensive test on two devices
import tensorflow as tf
import time
def matmul_op():
"""Multiply two matrices together"""
n = 2000
a = tf.ones((n, n), dtype=tf.float32)
@monikkinom
monikkinom / rnn-lstm.py
Last active September 3, 2019 04:44
Tensorflow RNN-LSTM implementation to count number of set bits in a binary string
#Source code with the blog post at http://monik.in/a-noobs-guide-to-implementing-rnn-lstm-using-tensorflow/
import numpy as np
import random
from random import shuffle
import tensorflow as tf
# from tensorflow.models.rnn import rnn_cell
# from tensorflow.models.rnn import rnn
NUM_EXAMPLES = 10000
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active February 26, 2025 01:37
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@arthur-e
arthur-e / graham_hull.py
Last active April 7, 2024 17:19 — forked from tixxit/hull.py
Graham's scan convex hull algorithm, updated for Python 3.x
def convex_hull_graham(points):
'''
Returns points on convex hull in CCW order according to Graham's scan algorithm.
By Tom Switzer <thomas.switzer@gmail.com>.
'''
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)
def cmp(a, b):
return (a > b) - (a < b)
@jnwhiteh
jnwhiteh / Array.java
Created January 6, 2016 22:15
An example of implementing Iterable and Iterator in Java
import java.util.Iterator;
import java.util.NoSuchElementException;
// Introduction:
//
// This is an example class meant to illustrate several differen concepts:
// * The use of type parameters (i.e. Java generics)
// * Implementing an iterator over some collection, in this case an array
// * Implementing the Iterable interface, which enables your collection
// to work with the Java simple for loops, i.e. (for String s : list)