echo 'export PATH="${HOME}/.local/bin:$PATH"' >> ~/.bashrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| export PATH=$ORIGINAL_PATH | |
| unset ORIGINAL_PATH | |
| export LD_LIBRARY_PATH=$ORIGINAL_LD_LIBRARY_PATH | |
| unset ORIGINAL_LD_LIBRARY_PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 | |
| ### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |