Skip to content

Instantly share code, notes, and snippets.

@nafeesb
nafeesb / tflite.md
Last active Dec 4, 2019
Keras Tensorflow TFLite common idioms
View tflite.md
@nafeesb
nafeesb / MayaDebug.md
Last active May 19, 2021
Maya python interactive debugging with Visual Studio Code
View MayaDebug.md
@nafeesb
nafeesb / CMakeNotes.md
Last active Jun 9, 2021
CMake b*lls*it
View CMakeNotes.md

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.

CMAKE_DEBUG_POSTFIX

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

Verbose Makefile

-DCMAKE_VERBOSE_MAKEFILE=true or make VERBOSE=1

@nafeesb
nafeesb / zmq_pubsub.py
Created Apr 16, 2019
Example PUB/SUB from PyZMQ
View zmq_pubsub.py
import zmq
import sys,os,time
#%%
port = '5563'
def server():
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind('tcp://*:%s' % port)
@nafeesb
nafeesb / ue-python.md
Last active Aug 11, 2019
Unreal engine python snippets
View ue-python.md

Preamble

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
nafeesb / python.md
Last active Feb 2, 2021
Useful python
View python.md

Clear tqdm error

tqdm._instances.clear()

Extend namedtuple with methods

ExperimentProps = namedtuple( 'ExperimentProps', config.keys() )
class Experiment(ExperimentProps):
    @property
    def root_path(self):
        return self._root_path
@nafeesb
nafeesb / numpy.md
Last active Mar 22, 2021
Numpy Idioms
View numpy.md

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
nafeesb / openaigym_install.md
Created Nov 21, 2018
Installing OpenAI Gym in Windows
View openaigym_install.md

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: https://github.com/openai/gym

pip install -e .
@nafeesb
nafeesb / regression1d.py
Last active Jan 9, 2019
pytorch 1d regression
View regression1d.py
import numpy as np
import torch
from torch import nn
from itertools import count
import time
#%%
# make some data
N = 100