Skip to content

Instantly share code, notes, and snippets.

View planetceres's full-sized avatar

Matt Shaffer planetceres

View GitHub Profile
@planetceres
planetceres / install_pipenv.md
Created February 3, 2019 21:31
pipenv installation notes Ubuntu 18.04

Installation Notes for pipenv on Ubuntu 18.04

1. Add ~/.local/bin to PATH

pypa/pipenv#2122 (comment)

echo 'export PATH="${HOME}/.local/bin:$PATH"' >> ~/.bashrc
@planetceres
planetceres / gitcreate.sh
Created February 2, 2019 02:23 — forked from robwierzbowski/gitcreate.sh
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)
@planetceres
planetceres / .cudadeactivate
Created January 16, 2019 17:53
CUDA Deactivate Script
#!/bin/sh
export PATH=$ORIGINAL_PATH
unset ORIGINAL_PATH
export LD_LIBRARY_PATH=$ORIGINAL_LD_LIBRARY_PATH
unset ORIGINAL_LD_LIBRARY_PATH
@planetceres
planetceres / .cudaactivate_9.0
Created January 16, 2019 17:53
CUDA Activation Script - 9.0
#!/bin/sh
ORIGINAL_PATH=$PATH
export PATH=/usr/local/cuda-9.0/bin:$PATH
ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/cuda-9.0/extras/CUPTI/lib64:/lib/nccl/cuda-9:$LD_LIBRARY_PATH
@planetceres
planetceres / update_firmware.sh
Created January 11, 2019 02:03
Update Realsense Firmware
#!/bin/bash
# Don't actually run this file as a script, just follow directions in the pdf which doesn't copy/paste
# https://www.intel.com/content/www/us/en/support/articles/000028171/emerging-technologies/intel-realsense-technology.html
# Copy/paste instructions https://github.com/IntelRealSense/librealsense/issues/2884#issuecomment-448049644
echo 'deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main'| sudo tee /etc/apt/sources.list.d/realsense-public.list
sudo apt-key adv--keyserverkeys.gnupg.net --recv-key 6F3EFCDE
sudo apt-get update
@planetceres
planetceres / cuda_installation_on_ubuntu_18.04
Created November 13, 2018 23:46 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@planetceres
planetceres / profile.py
Created October 31, 2018 18:46 — forked from thomwolf/profile.py
Profiling a Python module
import cProfile
import pstats
import my_slow_module
cProfile.run('my_slow_module.run()', 'restats')
p = pstats.Stats('restats')
p.sort_stats('cumulative').print_stats(30)
@planetceres
planetceres / cython_line_profiler.ipynb
Last active October 31, 2018 18:24 — forked from tillahoffmann/cython_line_profiler.ipynb
Demonstration of line-by-line profiling for `cython` functions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@planetceres
planetceres / useful_pandas_snippets.py
Last active August 21, 2018 18:10 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!
@planetceres
planetceres / rgb_from_prob.py
Created August 17, 2018 04:16
RGB values from probability value in range (0,1)
def rgb_from_prob(value, minimum=0, maximum=1):
'''
Based on: https://stackoverflow.com/a/20792531/3450793
'''
minimum, maximum = float(minimum), float(maximum)
ratio = 2 * (value-minimum) / (maximum - minimum)
g = int(max(0, 255*(1 - ratio)))
r = int(max(0, 255*(ratio - 1)))
b = 255 - g - r