Skip to content

Instantly share code, notes, and snippets.

View Manojbhat09's full-sized avatar

Manoj Bhat Manojbhat09

View GitHub Profile
@mtngld
mtngld / install_cuda.sh
Created March 22, 2016 21:18
Install CUDA 7.5 on AWS
# based on https://devtalk.nvidia.com/default/topic/880246/cuda-setup-and-installation/cuda-7-5-unstable-on-ec2-/post/4830634/#4830634
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -q -y
sudo apt-get -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install linux-generic
wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update -q -y
sudo apt-get install cuda -q -y
@Manojbhat09
Manojbhat09 / Running-python-on-browser
Created August 11, 2020 09:45
Js replacement resources for Deep learning applications
Brython
Skulpt
PyPy.js
Transcrypt
Pyodide
Good Summary of current methods:
https://stackoverflow.com/questions/30155551/python-in-browser-how-to-choose-between-brython-pypy-js-skulpt-and-transcrypt

Credits: Zuxin Liu https://github.com/liuzuxin

Ubuntu 18.04 Environment Configuration (from beginning to giving up)

1. Install Ubuntu

  • make sure that the /swap partition is twice larger than the computer memory.
  • 25GB is enough for root /.
  • The /boot partition should be use as 'EFI system partition'. 1GB is enough.
  • The / partition should be of 'primary' type. Others should be 'logical'.
@Manojbhat09
Manojbhat09 / fast-nested-loop.py
Last active October 4, 2020 20:17
Multiple Nested loops:: Fast nested loop function to use with your data processing (with variable list input).
'''Intro
If you have "Multiple Nested loops" to operate on a list with O(n^k) complexity,
Save time complex on itermediate list operations by utilizing python map-reduce!
'''
import numpy as np
from itertools import product
import time
'''Proposed
@yptheangel
yptheangel / QuantizationDL4J.java
Last active October 20, 2020 14:38
Ways to optimize Deeplearning4j model, FP32 to FP16 Quantization
// Tip 1: Do not save the updater if you do not plan to continue training your model
// Set false for saveUpdater flag.
ModelSerializer.writeModel(model, modelFilename, false);
// Results: Model size drop almost 40%.
// Tip 2: Convert FP32 to FP16 floating point precision(Quantization), currently DL4J only supports float. {DOUBLE, FLOAT, HALF}
// Convert the parameters just as below:
model = model.convertDataType(DataType.HALF);
// Results: Model size drop by 50%, half of its original size. Accuracy did not drop.
@johnhany
johnhany / KNN.cpp
Created August 6, 2017 11:28
KNN on MNIST with OpenCV
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
#define PIXELS_IN_IMAGE 28*28
#define ENABLE_TRAIN 1
@alyssaq
alyssaq / cplusplus-stl-containers.md
Last active June 29, 2021 22:30
C++ Standard Template Library (STL) containers

###Containers Forward Container: forward iterators - increment only in O(1)

  • begin(), end()
  • All containers

Reversible Container: bidirectional iterators - increment and decrement in O(1)

  • rbegin(), rend()
@Manojbhat09
Manojbhat09 / dbscan_python.py
Created July 16, 2021 03:40
Pure python DBSCAN algorithm. For simple interview practice.
# machine learning 101: dbscan
# wonderful unsupervised clustering, fast and works efficiently
# checkout HDBSCAN for an even more beautiful algorithm
'''
How to write dbscan:
1. look into the probem of clustering
2. start by first sample
3. compute the distance, get the neighbors
4. if the neighs are more than min samples, store the nighbors and expand recursively, save to same cluster and return, keep visited to avoid cycles,
@drj11
drj11 / ASCII.md
Last active October 23, 2022 03:35
How to memorise ASCII

How to memorise ASCII

You don't need to memorise ASCII as there is a handy chart available by typing man ascii in a Terminal. However, you may find it useful to remember some fun facts about ASCII.

Blocks of 32 are useful. 32 is 2⁵ (2 raised to the power 5) and a block of 32 is enough to represent all 26 common english letters plus some extra stuff.

ASCII is a coding for the first 128 numbers. 0 to 127.

@kanhua
kanhua / README.md
Last active February 1, 2023 17:08
A template of writing C or C++ extension for python and numpy

This gist demonstrates how to setup a python project that process a numpy array from C language.

To compile the project, run

make all

To test it, run

make test