Skip to content

Instantly share code, notes, and snippets.

View ravnoor's full-sized avatar

Ravnoor Singh Gill ravnoor

View GitHub Profile
@ravnoor
ravnoor / _verify-repair-permissions-disk.md
Created February 11, 2017 17:16 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@ravnoor
ravnoor / make_mrtrix3_non_sudo.sh
Last active April 28, 2018 18:07
Build MRtrix3 without root
# tested on silius with conda python(2.7) installed
TOOLSDIR=/host/silius/local_raid/ravnoor/00_toolbox
conda install libgcc
######################################################
# build and install gcc > 4.8 (c++ 11 support)
wget http://ca.mirror.babylon.network/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.gz
tar xzf gcc-4.9.4.tar.gz
@ravnoor
ravnoor / Keras.ipynb
Created April 24, 2017 02:38 — forked from prhbrt/Keras.ipynb
V-Net in Keras and tensorflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ravnoor
ravnoor / simple_mlp_theano.py
Created April 26, 2017 11:42 — forked from vinhkhuc/simple_mlp_theano.py
Simple Feedforward Neural Network using Theano
# Implementation of a simple MLP network with one hidden layer. Tested on the iris data set.
# Requires: numpy, sklearn, theano
# NOTE: In order to make the code simple, we rewrite x * W_1 + b_1 = x' * W_1'
# where x' = [x | 1] and W_1' is the matrix W_1 appended with a new row with elements b_1's.
# Similarly, for h * W_2 + b_2
import theano
from theano import tensor as T
import numpy as np
from sklearn import datasets
@ravnoor
ravnoor / python-parfor.py
Created July 4, 2017 15:10 — forked from jasimpson/python-parfor.py
Example code to demonstrate parallel for (parfor) loop implementation using joblib
# Example code to demonstrate parallel for loop implementation using joblib
from joblib import Parallel, delayed
import multiprocessing
# Vars
my_list = range(10)
squares = []
# Function to parallelize
def find_square(i):
@ravnoor
ravnoor / remove-hidden-junk
Created August 22, 2017 18:33
remove hidden junk files generated via mountain-duck SSH mounting connections
find . -maxdepth 1 -name '._*' -delete
@ravnoor
ravnoor / Documentation.md
Created August 23, 2017 16:18 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@ravnoor
ravnoor / tensorflow-build.sh
Last active August 29, 2017 19:46
Build tensorflow from source on Ubuntu 14.04
conda create -n tf-keras python=2.7
pip install numpy
wget https://github.com/bazelbuild/bazel/releases/download/0.5.2/bazel-0.5.2-installer-linux-x86_64.sh
# 0.5.4 incompatibility issues
chmod +x bazel-0.5.2-installer-linux-x86_64.sh
HOME=/00_toolbox ./bazel-0.5.2-installer-linux-x86_64.sh --prefix=/00_toolbox/bazel-build
git clone https://github.com/tensorflow/tensorflow
# https://github.com/andreimouraviev/Mets/blob/a8ce43b335584187f0728a4b3975c679ccf06cbc/UNET_2D_AUG17.py
# coding: utf-8
# In[1]:
import os
os.chdir(r'/home/amourav/Python')
import sklearn
from UTILS import *
@ravnoor
ravnoor / volatility.py
Created September 19, 2017 17:07
Keras loss functions
# https://github.com/Rachnog/Deep-Trading/blob/master/volatility/volatility.py
epsilon = 1.0e-9
def qlike_loss(y_true, y_pred):
y_pred = K.clip(y_pred, epsilon, 1.0 - epsilon)
loss = K.log(y_pred) + y_true / y_pred
return K.mean(loss, axis=-1)
def mse_log(y_true, y_pred):
y_pred = K.clip(y_pred, epsilon, 1.0 - epsilon)