Skip to content

Instantly share code, notes, and snippets.

View pyaf's full-sized avatar
😎
learning everyday

Rishabh Agrahari pyaf

😎
learning everyday
View GitHub Profile
# Build an image that can do training and inference in SageMaker
# This is a Python 3 image that uses the nginx, gunicorn, flask stack
# for serving inferences in a stable way.
FROM ubuntu:18.04
MAINTAINER Amazon AI <[email protected]>
RUN apt-get -y update && apt-get install -y --no-install-recommends \
FROM sklearn-base:0.23-1-cpu-py3
ENV SAGEMAKER_SKLEARN_VERSION 0.23-1
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
COPY requirements.txt /requirements.txt
RUN python -m pip install -r /requirements.txt && \
rm /requirements.txt
COPY dist/sagemaker_sklearn_container-2.0-py3-none-any.whl /sagemaker_sklearn_container-2.0-py3-none-any.whl
@pyaf
pyaf / tf-gpu.sh
Created June 9, 2021 07:18
TF 2.4 GPU Conda Setup
#!/bin/bash
# Initialize conda environment
echo 'Create Conda env? Type y or n and then press [ENTER]:'
read create_env
if [ $create_env = "y" ];
then
echo "Provide name for Conda virtualenv and then press [ENTER]:"
read env_name
@pyaf
pyaf / gpu
Last active June 28, 2020 07:51
Bash script for GPU usage and utilization monitoring in i3status bar.
#!/bin/bash
output=$(nvidia-smi --format=csv,noheader --query-gpu=name,power.draw,fan.speed,utilization.gpu,temperature.gpu,memory.used,memory.total)
IFS=',' read -r -a array <<< "$output"
name=${array[0]}
power=${array[1]}
fan=${array[2]}
util=${array[3]}
@pyaf
pyaf / init.vim
Last active March 8, 2021 04:46
My neovim config file
let mapleader =","
call plug#begin('~/.config/nvim/plugged')
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdtree'
Plug 'mboughaba/i3config.vim'
Plug 'jreybert/vimagit'
Plug 'LukeSmithxyz/vimling'
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'vimwiki/vimwiki'
@pyaf
pyaf / .tmux.conf
Created June 5, 2020 18:13
tmux > 2.8
set-option -g status-style bg=colour235 #base02
set-option -g status-style fg=colour136 #yellow
set-option -g status-style default
bind -n S-Right next-window
bind -n S-Left previous-window
# set window split
bind-key v split-window -h
bind-key b split-window
@pyaf
pyaf / configure_xorg.md
Last active February 24, 2019 11:11
Using only integrated graphics for display and Nvidia GPU for CUDA on Ubuntu 18.04.2

Steps to follow:

  1. Install suitable driver for your Nvidia GPU. Don't worry if nvidia-smi isn't working.
  2. Note the output of lspci | egrep 'VGA|3D', mine gives the following:
00:02.0 VGA compatible controller: Intel Corporation Device 3e92
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1f02 (rev a1)
  1. Edit your /etc/X11/xorg.conf as follows
@pyaf
pyaf / sources.list
Created December 29, 2018 13:39 — forked from rohitrawat/sources.list
Ubuntu 16.04 Xenial default /etc/apt/sources.list
#deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
@pyaf
pyaf / .tmux.conf
Last active January 11, 2021 04:33
My tmux config file, for tmux 2.8. (It breaks for >2.8. See comments.)
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
bind -n S-Right next-window
bind -n S-Left previous-window
# set window split
bind-key v split-window -h
bind-key b split-window
@pyaf
pyaf / model.py
Created May 20, 2018 11:46
CNN model architecture
def CNN_model():
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(124, 124, 3)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(32, (3, 3)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))