Skip to content

Instantly share code, notes, and snippets.

nafeesb /
Last active December 4, 2019 20:46
Keras Tensorflow TFLite common idioms
nafeesb /
Last active March 30, 2024 06:44
Maya python interactive debugging with Visual Studio Code
nafeesb /
Last active August 8, 2023 17:09
CMake b*lls*it

CMake is a haneous piece of software, but somehow it has more popularity than others. These are my notes on inane BS I have to deal with time to time in CMake.


Postfix like _Debug and _Release added to library names in windows.

Verbose Makefile


nafeesb /
Created April 16, 2019 01:28
Example PUB/SUB from PyZMQ
import zmq
import sys,os,time
port = '5563'
def server():
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind('tcp://*:%s' % port)
nafeesb /
Last active August 11, 2019 20:29
Unreal engine python snippets


import unreal_engine as ue
from unreal_engine.classes import PoseableMeshComponent, SkeletalMesh, Skeleton, SkeletalMeshComponent
from unreal_engine import FTransform, FVector, FRotator, FQuat, FSoftSkinVertex

Access object from editor

actor = ue.editor_get_selected_actors()[0]
nafeesb /
Last active March 20, 2024 22:23
Useful python

Script dir


Clear tqdm error


Extend namedtuple with methods

ExperimentProps = namedtuple( 'ExperimentProps', config.keys() )
class Experiment(ExperimentProps):
nafeesb /
Last active July 28, 2021 21:34
Numpy Idioms

Ouput Zero for divide by zero

length_err_pct = np.divide( pred_length, true_length, out=np.zeros_like(pred_length), where=true_length!=0)

Random subset of indices

sel = np.random.choice(testX.shape[0], samples, replace=False)

Save formatting

nafeesb /
Created November 21, 2018 19:00
Installing OpenAI Gym in Windows

Anaconda Configuration

conda create -n tensorflow tensorflow-gpu pip python=3.6
conda install ipython matplotlib cython mkl_random mkl mkl-devel swig

Install OpenAI Gym

Install from source:

pip install -e .
nafeesb /
Last active January 9, 2019 02:06
pytorch 1d regression
import numpy as np
import torch
from torch import nn
from itertools import count
import time
# make some data
N = 100