Skip to content

Instantly share code, notes, and snippets.

View planetceres's full-sized avatar

Matt Shaffer planetceres

View GitHub Profile
@planetceres
planetceres / cuda.sh
Created April 4, 2019 20:21 — forked from hadim/cuda.sh
A Bash functions to manage your Cuda/cuDNN installations on Linux (tested only on Ubuntu).
#!/usr/bin/env bash
# Cuda and friends installation done right.
# Switch default Cuda version using symbolic link: cuda.switch 9.2
# Install Cuda: cuda.install.cuda 10.0
# Install cuDNN to CUDA_HOME: cuda.install.cudnn 7.5
# Install NCCL to CUDA_HOME: cuda.install.nccl 2.4
# Install Cuda, cuDNN and NCCL: cuda.install 10.0 7.5 2.4
# Author: Hadrien Mary <[email protected]>
@planetceres
planetceres / cuda_9.0_cudnn_7.0.sh
Created April 4, 2019 20:20 — forked from ashokpant/cuda_9.0_cudnn_7.0.sh
Install CUDA Toolkit v9.0 and cuDNN v7.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v9.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb)
CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb"
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda-9-0
@planetceres
planetceres / append_sibling.py
Created April 3, 2019 22:50
Append sibling directory python
import os
dir_name = "directory_name"
cur_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.join(cur_path, dir_name))
@planetceres
planetceres / check_opencv.py
Last active July 30, 2019 00:48
OpenCV Version Conditionals
# https://www.pyimagesearch.com/2015/08/10/checking-your-opencv-version-using-python/
def is_cv2():
return check_opencv_version("2.")
def is_cv3():
return check_opencv_version("3.")
def is_cv4():
return check_opencv_version("4.")
@planetceres
planetceres / set_python.sh
Created March 6, 2019 21:46
Set Python System Default to 2 or 3
!#/bin/bash
set_python () {
DEFAULT_PYTHON_PATH=$(readlink /usr/bin/python)
DEFAULT_PYTHON=${DEFAULT_PYTHON_PATH##*-}
if [[ $1 = 2* ]]; then
PYTHON_SET_VERSION=2
elif [[ $1 = 3* ]]; then
PYTHON_SET_VERSION=3
@planetceres
planetceres / install_cudas.sh
Created March 4, 2019 22:49
Multiple CUDA Environments
#!/bin/bash
# https://medium.com/@IsaacJK/setting-up-a-ubuntu-18-04-1-lts-system-for-deep-learning-and-scientific-computing-fab19f7ca39d
sudo apt-get update
sudo apt-get upgrade
# Install core packages
sudo apt-get install vim csh flex gfortran libgfortran3 g++ \
cmake xorg-dev patch zlib1g-dev libbz2-dev \
libboost-all-dev openssh-server libcairo2 \
@planetceres
planetceres / cuda_activate.sh
Last active April 19, 2019 02:20
CUDA Activate version
#!/bin/bash
# Activate CUDA
cuda_activate () {
if [[ ":$PATH:" == *":/usr/local/cuda"* ]]; then
echo "CUDA already set in PATH. Deactivate before activating another version."
return 1
fi
@planetceres
planetceres / notepad.html
Created February 26, 2019 19:08 — forked from orrsella/notepad.html
Simple in-browser html notepad
data: text/html,
<html>
<head>
<title>Notepad</title>
<link rel="icon" type="image/png" href="http://icons.iconarchive.com/icons/hopstarter/sleek-xp-software/256/Notepad-icon.png">
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#text').bind('keyup', function() {
var content = $(this).val();
@planetceres
planetceres / Dockerfile
Created February 11, 2019 05:27 — forked from ruffsl/Dockerfile
Nvidia docker with rviz
FROM osrf/ros:melodic-desktop-bionic
# setup catkin workspace
ENV CATKIN_WS=/root/catkin_ws
RUN mkdir -p $CATKIN_WS/src
WORKDIR $CATKIN_WS/src
# clone source code
RUN git clone -b melodic-devel https://github.com/ros-visualization/rviz
@planetceres
planetceres / git_create.sh
Last active February 4, 2019 16:12
Create new Github repo from command line
#!/bin/bash
git_create () {
# Based on https://gist.github.com/robwierzbowski/5430952/
# Get defaults
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)