Skip to content

Instantly share code, notes, and snippets.

@shaybensasson
shaybensasson / Versions of everything.ipynb
Last active September 15, 2018 17:50
Versions of everything - to compare two environments
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shaybensasson
shaybensasson / PyCharm Tips and Tricks.ipynb
Last active September 6, 2018 08:32
PyCharm Tips and Tricks.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shaybensasson
shaybensasson / assert_version.py
Created September 15, 2018 17:49
Python assert tf version using LooseVersion
from distutils.version import LooseVersion
import tensorflow as tf
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.3'), 'Please use TensorFlow version 1.3 or newer'
print('TensorFlow Version: {}'.format(tf.__version__))
@shaybensasson
shaybensasson / python_quadcopter.bash
Created November 30, 2018 07:32
VirtualEnv Remote Interpreter script for Pycharm Professional Windows Client
#!/bin/bash
#DL cuda stuff
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64
# if virtualenvwrapper.sh is in your PATH (i.e. installed with pip)
source /usr/local/bin/virtualenvwrapper_py3.sh
@shaybensasson
shaybensasson / pycharm_update.sh
Last active February 24, 2020 17:52
PyCharm update script.
#!/bin/bash
#
# ---------------------------------------------------------------------
# PyCharm update script.
# ---------------------------------------------------------------------
#Originally from here:
#http://exponential.io/blog/2015/02/10/install-pycharm-on-ubuntu-linux/
VER=2019.3.3
FILE_NO_EXT=pycharm-professional-$VER
@shaybensasson
shaybensasson / pycharm64.vmoptions
Last active July 26, 2019 16:12
custom PyCharm VM options to increase memory of env
# custom PyCharm VM options
-Xms256m
-Xmx5120m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
@shaybensasson
shaybensasson / mnist_cnn_torch_sample.py
Last active April 20, 2020 06:27
Testing torch 1.1 installation
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
class Net(nn.Module):
@shaybensasson
shaybensasson / mnist_cnn_tf_sample.py
Created May 4, 2019 09:54
Testing tensorflow < 2 installation
'''Trains a simple convnet on the MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
#from __future__ import print_function
from tensorflow import keras as K
# from keras.datasets import mnist
# from keras.models import Sequential
@shaybensasson
shaybensasson / compile_NEST_py3_shay.sh
Created May 16, 2019 08:37
Compiles NEST simulation package for python3
#!/bin/bash
set -e
# Any subsequent(*) commands which fail will cause the shell script to exit immediately
cmake -DCMAKE_INSTALL_PREFIX=/home/shay/opt/packages/nest-simulator-2.16.0 \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.5 \
-DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.5m \
/home/shay/Downloads/NEST/nest-simulator-2.16.0
@shaybensasson
shaybensasson / xorg.conf
Created June 5, 2019 18:57
Mad Catz R.A.T.7 Mouse remap on ubuntu, create and paste it in /etc/X11/xorg.conf
Section "InputClass"
Identifier "Mouse Remap"
MatchProduct "Mad Catz R.A.T.7 Mouse"
MatchIsPointer "true"
MatchDevicePath "/dev/input/event*"
Option "Buttons" "24"
Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 10 11 12 0 0 0 16 17 7 6 0 0 0 0 0"
Option "AutoReleaseButtons" "20 21 22 23 24"
Option "ZAxisMapping" "4 5 6 7"
EndSection