In this article, I will share some of my experience on installing NVIDIA driver and CUDA on Linux OS. Here I mainly use Ubuntu as example. Comments for CentOS/Fedora are also provided as much as I can.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AGGRCOW | |
// Aggressive cows | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ll int64_t | |
#define MAX 1e5 | |
void aggrcow() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo add-apt-repository ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt-get install git | |
git --version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.lang.reflect.*; | |
public class Class1 { | |
public int x; | |
public Class1() { | |
// Default Constructor | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |