Skip to content

Instantly share code, notes, and snippets.

View p3jitnath's full-sized avatar
:octocat:
Think Different.

Pritthijit Nath p3jitnath

:octocat:
Think Different.
View GitHub Profile
@p3jitnath
p3jitnath / build_python.sh
Last active July 24, 2020 19:16
Build python from source
sudo apt install build-essential checkinstall
sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz
tar xvf Python-3.6.9.tar.xz
cd Python-3.6.9/
./configure
sudo make altinstall
@p3jitnath
p3jitnath / install-R.sh
Last active May 21, 2020 20:36
Install R on Ubuntu 20.04 LTS
sudo apt update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DF>
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu eoan->
sudo apt install r-base
R --version
# To use R:
# R
# Install RStudio Server
@p3jitnath
p3jitnath / tmux.txt
Last active May 26, 2020 08:48
Tmux on Ubuntu 20.04 LTS
# Install
sudo apt install tmux
# Named Session
tmux new -s session_name
# Detach
[Ctrl-b] d
# List
@p3jitnath
p3jitnath / remove-python.sh
Last active May 21, 2020 23:09
Remove a version of python
prefix='/usr/local/'
pyver='3.6'
sudo rm -rf \
${prefix}bin/python${pyver} \
${prefix}bin/pip${pyver} \
${prefix}bin/include/python${pyver} \
${prefix}lib/libpython${pyver}.a \
${prefix}lib/python${pyver} \
${prefix}bin/python${pyver} \
@p3jitnath
p3jitnath / linux-kernel-panic-fix.sh
Created May 25, 2020 16:23
Fix Linux Kernel Panic
sudo apt full-upgrade
# Add processor.max_cstate=0 intel_idle.max_cstate=0 idle=poll to GRUB_CMDLINE_LINUX in /etc/default/grub
update-grub
@p3jitnath
p3jitnath / CMakeLists.txt
Last active December 10, 2020 20:21
Install TensorRT on Ubuntu 20.04 LTS
#
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@p3jitnath
p3jitnath / opencv-fonts.py
Created June 29, 2020 06:21
Custom OpenCV font
import cv2
import numpy as np
img = np.zeros((100, 300, 3), dtype=np.uint8)
ft = cv2.freetype.createFreeType2()
ft.loadFontData(fontFileName='Ubuntu-R.ttf',
id=0)
ft.putText(img=img,
text='Quick Fox',
@p3jitnath
p3jitnath / torch_seed.py
Created July 2, 2020 08:34
Seed PyTorch for Reproducibility
import torch
torch.manual_seed(42)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
import numpy as np
np.random.seed(42)
@p3jitnath
p3jitnath / extract_from_geojson.py
Last active July 13, 2020 14:44
Geocoding Setup using Selenium
import json
from shapely.geometry import shape, Point
with open('./Data/nyc-neighborhoods.geo.json') as f:
js = json.load(f)
def get_nbd(lng, lat):
point = Point(lng, lat)
for feature in js['features']:
polygon = shape(feature['geometry'])
@p3jitnath
p3jitnath / install-hdf4.sh
Last active December 5, 2020 20:01
Install HDF4
sudo apt-get install libhdf4-dev
pip install pyhdf