Skip to content

Instantly share code, notes, and snippets.

View DEKHTIARJonathan's full-sized avatar
👨‍🚀
Focused on breaking the speed of light. Beam me up, Scotty

Jonathan DEKHTIAR DEKHTIARJonathan

👨‍🚀
Focused on breaking the speed of light. Beam me up, Scotty
View GitHub Profile
@DEKHTIARJonathan
DEKHTIARJonathan / logging_imports.py
Created June 14, 2022 22:06
Logging all imports in Python
import builtins
import sys
__real_import__ = __import__
__IMPORTED_MODULES__ = []
def __import_debugger__(*args, **kwargs):
try:
module = args[0]
@DEKHTIARJonathan
DEKHTIARJonathan / create_hellotensor.py
Created August 19, 2020 21:19 — forked from omimo/create_hellotensor.py
A simple example for saving a tensorflow model and preparing it for using on Android
# Create a simple TF Graph
# By Omid Alemi - Jan 2017
# Works with TF <r1.0
import tensorflow as tf
I = tf.placeholder(tf.float32, shape=[None,3], name='I') # input
W = tf.Variable(tf.zeros_initializer(shape=[3,2]), dtype=tf.float32, name='W') # weights
b = tf.Variable(tf.zeros_initializer(shape=[2]), dtype=tf.float32, name='b') # biases
O = tf.nn.relu(tf.matmul(I, W) + b, name='O') # activation / output
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@DEKHTIARJonathan
DEKHTIARJonathan / simple_args_parsing.sh
Created May 25, 2019 00:34 — forked from guenp/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@DEKHTIARJonathan
DEKHTIARJonathan / delete_git_submodule.md
Created March 10, 2019 09:23 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@DEKHTIARJonathan
DEKHTIARJonathan / .profile
Last active March 5, 2019 10:24
Linux ZSH Config
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
FROM nvidia/cudagl:10.0-runtime-ubuntu16.04
LABEL version="1.0" maintainer="Jonathan DEKHTIAR <contact@jonathandekhtiar.eu>"
# Install the most recent bazel release.
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /workspace
# Install Basic Dependencies and Python 3
#!/bin/bash
# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback
if [[ -z "${LOCAL_USER_ID}" ]]; then
echo "Connecting as user: 'root' ..."
exec "$@"
# command to launch the script:
python tensorflow_test.py
# command to watch `nvidia-smi`
watch -n 0.3 nvidia-smi
@DEKHTIARJonathan
DEKHTIARJonathan / tensorlayer_api_test.py
Created August 16, 2018 09:26
Non Sequential API Attempt
import inspect
import time
import wrapt
import pprint
def get_caller(skip=2):
try:
stack = inspect.stack()