Skip to content

Instantly share code, notes, and snippets.

View MohamedKari's full-sized avatar

MohamedKari

View GitHub Profile
@MohamedKari
MohamedKari / custom-env-installer.sh
Last active March 1, 2020 21:25
Install Custom Env on SageMaker Notebook Instance
#!/bin/sh
source deactivate
export CONDA_CUSTOM_ENV_URL="$1"
export CONDA_CUSTOM_ENV_PARENT_DIR="/home/ec2-user/SageMaker"
export CONDA_CUSTOM_ENV_DIR="$CONDA_CUSTOM_ENV_PARENT_DIR/custom_env"
cd $CONDA_CUSTOM_ENV_PARENT_DIR
@MohamedKari
MohamedKari / gist:7d12a86fbd0d4d656ac9adc3770b6b63
Last active March 3, 2020 15:59
Install AWS CLI auto complete
brew install zsh-completions
autoload -Uz compinit
compinit
autoload bashcompinit && bashcompinit
source /usr/local/share/zsh/site-functions/_aws

Conda Env Management

tested on MacOS

Alternative 1: Create conda-env command by command

Ensure anaconda is in your path env variable, e.g. /usr/local/anaconda3/bin after default-installing with brew.

Create the env and install dependencies.

conda create -p ./conda-env python=3.7
conda install -p ./conda-env/ anaconda
@MohamedKari
MohamedKari / custom_env.yml
Last active March 4, 2020 12:49
Basic conda env.yml with anaconda and tensorflow
name: custom_env
dependencies:
- python=3.6
- anaconda
- boto3
- pip
- pip:
- tensorflow>=2.1.0
- ipykernel
'''
**Author**:
Mohamed Kari <contact@mkari.de>
**Describtion**
Clone private github repos effortlessly into your Notebook Cloud VM with a two-liner.
**Usage**
Alternative 1 (recommended):
@MohamedKari
MohamedKari / pipenv_usage.md
Created March 12, 2020 08:38
Pipenv Usage

Building a pipenv

Alternative 1: Incremental

Initialize

First, create a new and empty pipenv. If there is no Pipfile, the following command will create an empty one:

pipenv install
@MohamedKari
MohamedKari / Dockerfile
Last active May 22, 2020 10:30
CUDA with Python Dockerfile
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
SHELL ["/bin/bash", "-c"]
ENV PYENV_ROOT="/.pyenv"
# Install pyenv dependencies & fetch pyenv
# see: https://github.com/pyenv/pyenv/wiki/common-build-problems
RUN apt-get update && \
apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
@MohamedKari
MohamedKari / Makefile
Last active May 28, 2020 19:52
CA-signed Certificate Generation with self-generated CA
# args
SAN_FILE = localhost.san
# vars
NAME = $(basename $(SAN_FILE))
ca_key_passphrase = $(shell openssl rand -base64 32)
define ca_conf_template
[ req ]
default_bits = 4096
__pycache__
@MohamedKari
MohamedKari / sequence_aware_threading.py
Created August 21, 2020 18:29
Sequence-Aware Threading
import time
import logging
import importlib
from typing import List, Any
from enum import Enum
from collections import deque
from concurrent.futures import ThreadPoolExecutor
from abc import ABC, abstractmethod
import numpy as np