Skip to content

Instantly share code, notes, and snippets.

@shaybensasson
shaybensasson / timing.py
Created June 14, 2017 07:54
timing in python
import time
from timeit import default_timer as timer
from datetime import timedelta
t_start = timer()
time.sleep(1)
#print(timer()-t_start)
print(timedelta(seconds=timer()-t_start))
@shaybensasson
shaybensasson / mnist_nlp_seed.py
Last active June 14, 2017 08:47
trying keras to be random seeded (with theano and/or tf)
'''
trying keras to be random seeded
Switch backends by changin ~/.keras/keras.json:
Theano: https://drive.google.com/open?id=0B-FcStylmYuVU1E5S25QX2JXcGs
TensorFlow: https://drive.google.com/open?id=0B-FcStylmYuVNnpfZERoeUo0QnM
Keras Backend:
*Theano (1 epoch, GPU):
Test loss: 0.111780489241
@shaybensasson
shaybensasson / ipython-notebook.conf
Last active August 9, 2017 13:16
Jupyter upstart service for ubuntu (put it in /etc/init)
description "Jupyter Upstart script"
start on filesystem or runlevel [2345]
stop on shutdown
script
export HOME="/home/shay" cd $HOME/
echo $$ > /var/run/jupyter_start.pid
#exec jupyter-notebook --config='$HOME/.jupyter/jupyter_notebook.config.py'
#exec ipython notebook
@shaybensasson
shaybensasson / dl_libs_versions.py
Created January 30, 2018 13:07
Versions of deep learning libs python script
import numpy
print('numpy.__version__')
print(numpy.__version__)
import theano
print('theano.__version__')
print(theano.__version__)
import tensorflow
print('tensorflow.__version__')
print(tensorflow.__version__)
import keras
@shaybensasson
shaybensasson / install-gcc-4.9.4.sh
Created March 5, 2018 15:30
Install gcc-4.9.4.sh which is compatible with matlab 2017b, ubuntu 16 gcc is 5.4.0
#!/bin/bash
# this script installs GCC 4.9.4
# to use it navigate to your home directory and type:
# sh install-gcc-4.9.4.sh
# download and install gcc 4.9.4
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz
tar xzf gcc-4.9.4.tar.gz
cd gcc-4.9.4
@shaybensasson
shaybensasson / .gitmessage
Last active July 31, 2018 08:42
My git commit template message
~ 50-character subject line ~
~ 72-character wrapped longer description. ~
# Description of why, not how.
# Feel free to be detailed.
# nano: use `ctrl+c` to get line/character position
@shaybensasson
shaybensasson / .bashrc
Last active July 26, 2019 15:57
My terminal .bashrc suffix addition
#Trim terminal command prefix
#ORIGINAL:
#export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
export PS1="\[\033[01;34m\]\w\[\033[00m\]\$ " #path only
# ---------------------------------------------------------------------
# DL cuda stuff
# ---------------------------------------------------------------------
source /home/shay/DL_cuda_stuff.sh
@shaybensasson
shaybensasson / pip
Created August 9, 2018 09:22
pip script instead of pip_ROOT to force using a virtualenv
#!/bin/bash
echo "THIS IS THE ROOT 'pip'!"
echo "(The original was renamed to 'pip_ROOT')."
echo ""
echo "Please use a virtual environment to install packages!"
echo "You can activate a vm using 'workon'."
@shaybensasson
shaybensasson / pet-snippet.toml
Last active February 12, 2025 10:03
description
[[snippets]]
description = "edit pet configs and snippets"
command = "code ~/.config/pet/snippet.toml"
tag = ["pet"]
output = ""
[[snippets]]
description = "edit snippets_menu jupyter plugin configuration"
command = "code ~/.local/share/jupyter/nbextensions/snippets_menu/my_snippets.js"
tag = ["python", "jupyter"]
@shaybensasson
shaybensasson / user.js
Last active August 28, 2018 13:07
Slack RTL support
// ==UserScript==
// @name Slack RTL
// @namespace http://blah
// @version 0.1
// @description Support RTL/Hebrew in slack.com, from here: https://github.com/gregvish/slackrtl
// @author
// @match https://*.slack.com/*
// @grant GPL
// ==/UserScript==
/* jshint -W097 */