Skip to content

Instantly share code, notes, and snippets.

pmod prerakmody

Block or report user

Report or block prerakmody

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
prerakmody /
Last active Nov 18, 2019
3D Visualizations
Get cylinder points in 3D grid given start and end point of cylinder axis
import sys
import pdb
import copy
import numpy as np
from scipy.spatial import distance
prerakmody /
Last active Oct 28, 2019
Regex Samples
import re
# Sample 1 - Finding between two chars
str1 = 'M 50.77925000000002 398.604 a 2.5 2.5 0 1 0 5 0 a 2.5 2.5 0 1 0 -5 0' # find string between 'M' and 'a'
str2 = 'M226.31525000000002,401.996a2.5,2.5 0 1,0 5,0a2.5,2.5 0 1,0 -5,0'
out1 = [s.strip() for s in re.findall(r'M([\d,. ]+)a', str1)]
prerakmody /
Last active Jun 21, 2019
Optimization Techniques
from autograd import grad
import autograd.numpy as anp
def objective():
if __name__ == "__main__":
W = np.random.normal(0, 1,X_train.shape[1])
gradient = grad(objective)
W -= gradient(W, X_11, X_12, X_21, X_22) * LR
prerakmody /
Last active May 17, 2019
Ubuntu Hacks



  • HCI = Host Controller Interface of Bluetooth Protocol Stack
  • hciconfig -a
    • Check the LMP version to know the bluetooth version
  • Check MAC address by using hcitool dev
  • Check Bluetooth connections via hcitool con
  • Find device info via hcitool info BB:BB:BB:BB:BB:BB
  • Run bluetoothctl devices to check which devices are available and just general logs
prerakmody /
Last active May 25, 2019
Google Colab Hacks
# memory footprint support libraries/code
# ! ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi
# ! pip install humanize
# ! pip install jupyter_contrib_nbextensions
# ! jupyter contrib nbextension install --user
# ! jupyter nbextension enable codefolding/main
# ! jupyter nbextension enable hinterland/hinterland
import psutil
from sklearn import metrics
from sklearn import preprocessing
from sklearn.preprocessing import normalize
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.model_selection import StratifiedKFold
from imblearn.over_sampling import SMOTE
from sklearn.svm import SVC
import pdb; #pdb.set_trace()
import pandas as pd
from IPython.display import display
# 1. Kick Off
df = pd.read_csv('myfile.csv')
print (df.head())
print (df.head(n=10))
print (df.columns)
col_Y = ''
prerakmody / bar.m
Last active Jun 4, 2019
View bar.m
\hrule height 0.5pt % The actual bar
\kern0.5ex% % Distance between bar and symbol
\kern-0.1em% % Shortening on the left side
\kern-0.1em% % Shortening on the right side
prerakmody /
Last active Jun 9, 2019
Jupyter Notebook Hacks

Fresh Install

  • pip install jupyter

Check Installations

  • pip freeze | grep jupyter
  • pip freeze | grep ipy
  • pip freeze | grep notebook


  • To upgrade any specific package : pip install --upgrade
View Pseduo - Code
\caption{Lawler's pseudo-polynomial algorithm}
\KwData{S(i,j,k) with S sorted by due-date}
\KwResult{integer representing the minimum tardiness of a schedule S}
You can’t perform that action at this time.