Skip to content

Instantly share code, notes, and snippets.

View chintak's full-sized avatar

Chintak Sheth chintak

View GitHub Profile

ID: cce22844-49bf-4a97-a522-2a150017db66

Created time: 2023-08-09T04:35:00.000Z

Last edited time: 2023-08-16T19:13:00.000Z

Path: 2500-01-01-TEMPLATE:-Markdown-Syntax-with-Notion-Hugo

Publish Date: 2500-01-01

Status: Published

Date: 2500-01-01 Draft: false Math: mathjax

@chintak
chintak / install_simplecv.sh
Last active June 1, 2018 15:56
Install SimpleCV/OpenCV in a Virtual Environment on Mac OSX
# First install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# Choose the name of the virtualenv as simplecv
virtualenv simplecv --no-site-packages
source simplecv/bin/activate
# This activates the virtualenv; your command prompt should change from `$` to `(simplecv)$`
# Next the dependencies
sudo easy_install pip # Can be ignored, if pip already present
@chintak
chintak / Makefile
Created April 20, 2018 15:36
CUDA ``bincount`` and ``reduce`` op implementation
NVCC=/usr/local/cuda/bin/nvcc
CCFLAGS=-std=c++11 --expt-extended-lambda -G -Xcompiler -rdynamic -m64 $(CFLAGS)
ARCH=-gencode arch=compute_35,code=sm_35
LIBS=-lcudart
TARGET=run
SOURCES = TestBincount.cu histogram.cu
OBJECTS = $(SOURCES:%.cu=%.o)
all: $(TARGET)
@chintak
chintak / opencv_OSX.sh
Last active October 31, 2016 14:56 — forked from tkdave/gist:4150916
OpenCV with a Virtualenv
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current
brew update
@chintak
chintak / cuda-install.sh
Created April 20, 2016 09:32
Installing CUDA 7.5 on AWS G2 instance
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
echo ' /usr/local/cuda/lib64
/usr/local/cuda/lib' | sudo tee -a /etc/ld.so.conf.d/cuda.conf > /dev/null
@chintak
chintak / tricks.sh
Last active March 26, 2016 08:13
Shell tricks
# Process files in a loop with arbitrary names
while IFS= read -r -d '' f; do
cp "$f" /path2/
done < <(find /path/ -wholename '*.mp3' -print0)
# Find a pattern and replace in place using sed
ls /path/*.csv -1 | grep "subj[0-9]_" | sed -n "s/\(.*subj\)\([0-9].*\)/mv \1\2 \10\2/p"
# Count the number of files in each sub directory and write to a file
find images/ -maxdepth 1 -print0 | xargs -0 -n 1 -I dir sh -c 'printf dir"\t"; find dir/ -name "*.jpg" | wc -l' &> distribution.txt
@chintak
chintak / new_env.sh
Created January 2, 2014 17:01
Save to ``~/Documents/venv/`` Add ``alias newvirtualenv="source ~/Documents/venv/new_env.sh $1"`` to ~/.bash_profile. Invoke it using: ``newvirtualenv ENV_NAME``
mkvirtualenv $1
ln -ns ~/Documents/venv/dev_pack2/lib/python2.7/site-packages/* ~/Documents/venv/$1/lib/python2.7/site-packages
# Ipython installtion
ln -s ~/Documents/venv/dev_pack2/bin/i* ~/Documents/venv/$1/bin/
# ln -s ~/Documents/venv/dev_pack2/lib/python2.7/site-packages/IPython ~/Documents/venv/$1/lib/python2.7/site-packages/
# Nosetests installtion
ln -s ~/Documents/venv/dev_pack2/bin/nose* ~/Documents/venv/$1/bin/
# .bash_profile
#-----------------------
alias ls='ls -G'
alias ipn="cd ~/Notebooks/; ipython notebook --pylab=inline"
alias crp="cd ~/Documents/Repositories"
alias si2="workon skimage2; crp; cd scikit-image"
alias newvirtualenv="source ~/Documents/venv/new_env.sh $1"
export PS1="\e[0;31m\h: \W$ \e[m"
cpdef _inpaint_criminisi(cnp.float_t [:, ::1] painted,
cnp.int8_t [:, ::1] mask,
cnp.uint8_t window,
cnp.float_t ssd_thresh):
cdef:
cnp.float_t [:, ::1] source_image, confidence, gauss_mask, dx, dy
cnp.float_t [:, ::1] smooth_painted, template, valid_mask
cnp.int16_t [:, ::1] fill_front
cnp.int8_t [:, ::1] nx, ny, mask_template
@chintak
chintak / vim_conf.sh
Last active December 3, 2015 07:00
Install vim packages
# Install pathogen package manager
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# Install other packages
cd ~/.vim/bundle
git clone https://github.com/nvie/vim-flake8.git