Skip to content

Instantly share code, notes, and snippets.

# using Droid Sans Mono Nerd Font
# POWERLEVEL9K CONFIG
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_PYTHON_ICON=''
POWERLEVEL9K_ANACONDA_BACKGROUND='cyan'
POWERLEVEL9K_DIR_HOME_BACKGROUND="blue"
@thepulkitagarwal
thepulkitagarwal / Class1.java
Created June 30, 2018 19:26
Java Generics with Lists
import java.util.*;
import java.lang.reflect.*;
public class Class1 {
public int x;
public Class1() {
// Default Constructor
}
@thepulkitagarwal
thepulkitagarwal / Install NVIDIA Driver and CUDA.md
Created February 24, 2018 10:24 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
def print_graph_nodes(filename):
import tensorflow as tf
g = tf.GraphDef()
g.ParseFromString(open(filename, 'rb').read())
print()
print(filename)
print("=======================INPUT=========================")
print([n for n in g.node if n.name.find('input') != -1])
print("=======================OUTPUT========================")
print([n for n in g.node if n.name.find('output') != -1])
# This was created with @warptime's help. Thank you!
from tensorflow.python.framework import graph_util
from tensorflow.python.framework import graph_io
from keras.models import load_model
from keras import backend as K
import os.path as osp
model = load_model(path_to_model)
nb_classes = 1 # The number of output nodes in the model
import org.tensorflow.contrib.android.TensorFlowInferenceInterface;
/** One time initialization: */
TensorFlowInferenceInterface tensorflow = new TensorFlowInferenceInterface(getAssets(), "file:///android_asset/model.pb");
/** Continuous inference (floats used in example, can be any primitive): */
// loading new input
tensorflow.feed("input:0", input, INPUT_SHAPE); // INPUT_SHAPE is an long[] of expected shape, input is a float[] with the input data
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
git --version
// AGGRCOW
// Aggressive cows
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define MAX 1e5
void aggrcow() {
@thepulkitagarwal
thepulkitagarwal / breakIntoFractions.py
Last active November 23, 2015 11:20
Input: Any fraction between 0 and 1, Output: A set of distinct natural numbers, the sum of reciprocals of these numbers is the input
from fractions import gcd
def addToList(denominators, q):
if(q in denominators):
addToList(denominators, q+1)
addToList(denominators, q*(q+1))
else:
denominators.append(q)
def breakIntoFractions(denominators, p, q):
@thepulkitagarwal
thepulkitagarwal / eggs-and-floors.py
Last active November 5, 2015 16:34
Egg Dropping Puzzle
maxFloorsDictionary = {}
def findMaxFloors(numberOfEggs, numberOfSteps):
tupleEggsSteps = (numberOfEggs, numberOfSteps)
if (numberOfEggs == 1 or numberOfSteps == 1):
return numberOfSteps
elif tupleEggsSteps in maxFloorsDictionary:
return maxFloorsDictionary[tupleEggsSteps]
else:
maxFloorsDictionary[tupleEggsSteps] = findMaxFloors(numberOfEggs, numberOfSteps - 1) + findMaxFloors(numberOfEggs - 1, numberOfSteps - 1) + 1