Skip to content

Instantly share code, notes, and snippets.

View aakbar5's full-sized avatar

asad akbar aakbar5

View GitHub Profile
@aakbar5
aakbar5 / Tensorflow: Tensoboard
Created March 11, 2019 13:01
Tensorflow: Visualize freezed model file (.pb) in Tensorboard
To visualize freezed Tensorflow model file use Tensorboard:
- Download import_pb_to_tensorboard.py (https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/import_pb_to_tensorboard.py)
- Create a directory (/path/to/tmp/folder) where intermediate files will be created to visualize model in Tensorboard.
- Execute
- python import_pb_to_tensorboard.py --model_dir="/path/to/folder/tensorflow_model_frozen.pb" --log_dir="/path/to/tmp/folder"
NOTE: Wrapped values to param # model_dir and param # log_dir in "". Otherwise it might not work.
- tensorboard --logdir="/path/to/tmp/folder"
@aakbar5
aakbar5 / makefile: variable assignment
Last active March 11, 2019 13:07
Makefile: Exploring different ways to set value of a variable
# Ref: https://www.gnu.org/software/make/manual/html_node/Setting.html#Setting
########
# Setting variables:
# ?= Set variable if it is empty
# := Expand value variable before assignment,
# NOTE: (1) The behaviour of ::= is same as :=
# (2) Expansion of value variable will be only once at the of value assignment.
# = Simple variable assignment, value will evaluated/expanded on its usage
# += Append value to variable
@aakbar5
aakbar5 / makefile: setting variables
Last active March 6, 2019 22:36
makefile: setting variables globally as well as under phony target
GLOBAL_VAR=GOLBAL_VAR_VALUE # This value will be set as it is global
export GLOBAL_VAR_EXPORT=GLOBAL_VAR_EXPORT_VALUE # This value will be set as it is global
# @$(foreach var, $(filter GB_ENV_%, $(.VARIABLES)), $(eval export $(subst GB_ENV_,,$(var))=$($(var))))
all:
# Following two vars remain unset as Makefile doesn't set var under phony target
@LOCAL_VAR=LOCAL_VAR_VALUE
@export LOCAL_VAR_EXPORT=LOCAL_VAR_EXPORT_VALUE
@aakbar5
aakbar5 / bashrc - Ubuntu 18.04.1
Created February 8, 2019 21:45
bashrc for Ubuntu 18.04.1
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@aakbar5
aakbar5 / bashrc - Ubuntu 14.04.5
Last active February 8, 2019 21:43
bashrc for Ubuntu 14.04.5
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@aakbar5
aakbar5 / multiple python installation
Created November 16, 2018 23:17
Manage multiple Python installations on Ubuntu machine
#
# Commands are tested on Ubuntu 14.04
#
# Install the python3 as Ubuntu 14.04 comes with Python2
sudo apt-get update -y && \
sudo apt-get install python-pip python3 python3-pip
# Let's manage two versions
@aakbar5
aakbar5 / multiple gcc installation
Last active November 16, 2018 23:13
Manage multiple GCC installations on Ubuntu machine
#
# Commands are tested on Ubuntu 14.04
#
# Issue following command to verify which GCC version is installed
gcc --version
--- OR ---
g++ --version
gcc (Ubuntu 4.8.5-4ubuntu8~14.04.2) 4.8.5
@aakbar5
aakbar5 / docker tips
Last active February 13, 2019 16:20
Find docker host name, ip and id inside the docker container.
# Incase you are interested to find out docker short, full id, hostname and ip address
# of the running container, execute following commands from inside of your container
# To find out docker container id (short form)
DOCKER_ID=`cat /etc/hostname`
echo $DOCKER_ID
# To find out docker container host name using /etc/hosts
HOST_NAME=`grep $DOCKER_ID /etc/hosts | sed 's/\s/\n/g' | tail -1`
# - grep: search for the line having docker id
@aakbar5
aakbar5 / dts <> dtb
Created April 5, 2018 17:07
dts <> dtb
# To convert dts file into dtb
<kernel-source>/scripts/dtc/dtc -I dts -O dtb <dts_file> -o <dtb_file>
# To convert dtb to dts
<kernel-source>/scripts/dtc/dtc -I dtb -O dts <dtb_file> -o <dts_file>
# Both of above commands are using dtc built with linux kernel source.
# However you can also use dtc binary comes with ubuntu packages. For this you
# need to install following package:
@aakbar5
aakbar5 / nvidia egl error
Created November 7, 2017 14:35
nvidia egl error from ldconfig
In case you are having ldconfig error in Ubuntu 14.04.5 LTS related to Nvidia EGL use follow fixes
Error
---
/sbin/ldconfig.real: /usr/lib/nvidia-384/libEGL.so.1 is not a symbolic link
/sbin/ldconfig.real: /usr/lib32/nvidia-384/libEGL.so.1 is not a symbolic link
Fix
---
sudo mv /usr/lib/nvidia-384/libEGL.so.1 /usr/lib/nvidia-384/libEGL.so.1.org