Skip to content

Instantly share code, notes, and snippets.

View paulonteri's full-sized avatar
💻
Building

Paul Onteri paulonteri

💻
Building
View GitHub Profile
@paulonteri
paulonteri / PY0101EN-5-2-Numpy2D.ipynb
Created March 24, 2019 22:56
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulonteri
paulonteri / east&southernafricamosquitoes.ipynb
Created April 22, 2019 06:58 — forked from itsmuriuki/east&southernafricamosquitoes.ipynb
East and South African Mosquito classifier: This notebook has images of mosquitoes of three species which are prevalent in the areas mentioned and could be carriers of the parasite Plasmodium in their salivary glands which is the causative agent of malaria.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git clone https://github.com/fastai/fastai
cd fastai
conda create -n fastai python=3.6 anaconda
conda env update
# bash include source
# windows no source
@paulonteri
paulonteri / models.py
Created April 22, 2020 13:25
Simple Django Notes Model
from django.db import models
class Note(models.Model):
title = models.CharField(max_length=20)
description = models.CharField(max_length=255)
note = models.TextField() # Actual note
@paulonteri
paulonteri / serializers.py
Created April 22, 2020 14:43
A simple Model Serializer
from rest_framework import serializers
from .models import Note
class NoteSerializer(serializers.ModelSerializer):
class Meta:
model = Note
fields = ['id', 'title', 'description', 'note']
@paulonteri
paulonteri / views.py
Created April 24, 2020 10:07
A simple APIView
from rest_framework import status # provides identifiers for each status code
from rest_framework.response import Response # determines the correct content type to return
from rest_framework.views import APIView
from .models import Note
from .serializers import NoteSerializer
class NoteApi(APIView):
# list or add Note instances
@paulonteri
paulonteri / urls.py
Created April 24, 2020 10:30
Project url patterns
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('myapiapp.urls')),
]
@paulonteri
paulonteri / urls.py
Created April 24, 2020 12:30
App urls
from django.urls import path
from .views import NoteApi
urlpatterns = [
path('api/notes', NoteApi.as_view()),
]
@paulonteri
paulonteri / Dockerfile
Created May 7, 2020 10:29
Django Dockerfile
# this Dockerfile starts with a Python 3.6 parent image
FROM python:3.6
# this means that Docker won’t buffer the output from your application;
# instead, you will see your output in your console
ENV PYTHONUNBUFFERED 1 # environment variable
# create a directory for our project in the container
RUN mkdir /code
# Set the working directory to /code
@paulonteri
paulonteri / Dockerfile
Created May 7, 2020 11:13
React Dockerfile
# REACT PROJECT SETUP
# this Dockerfile starts with a Node 12.2.0 parent image
FROM node:12.2.0 AS build
# Set the working directory to /code
WORKDIR /code
# Copies package.json and package-lock.json to Docker environment
COPY package*.json ./
COPY yarn.lock ./
COPY . .