Skip to content

Instantly share code, notes, and snippets.

Douglas Duhaime duhaime

Block or report user

Report or block duhaime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@duhaime
duhaime / encode.py
Last active Oct 3, 2019
Simple ASCII Encoding
View encode.py
import numpy as np
from scipy.misc import imread
from skimage.transform import resize
import matplotlib.pyplot as plt
import json, glob
#%matplotlib inline
def path_to_string(path):
'''Given a path to an image, return a string of that image as ascii'''
@duhaime
duhaime / index.html
Last active Oct 3, 2019
Posenet in the browser
View index.html
<html>
<head>
<meta charset='UTF-8'>
<title>PoseNet</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/addons/p5.dom.min.js'></script>
<script src='https://unpkg.com/ml5@0.3.1/dist/ml5.min.js' type='text/javascript'></script>
</head>
<body>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>title</title>
</head>
<body></body>
<script src='gunzip.min.js'></script>
<script type='text/javascript'>
@duhaime
duhaime / vectorize_image.py
Created Sep 12, 2019
Keras Image to Vector
View vectorize_image.py
from keras.preprocessing.image import load_img, save_img, img_to_array, array_to_img
from keras.applications import Xception, VGG19, InceptionV3, imagenet_utils
import keras.backend as K
import numpy as np
model = Xception(weights='imagenet')
# VGG16, VGG19, and ResNet take 224×224 images; InceptionV3 and Xception take 299×299 inputs
img = load_img('l.jpg', target_size=(299,299))
arr = img_to_array(img)
@duhaime
duhaime / app.py
Last active Sep 11, 2019
smtp python
View app.py
from flask import Flask, render_template
from smtp_client import send_email
from smtp_server import SMTPServer
app = Flask(__name__)
@app.route('/send_email')
def email():
server = SMTPServer()
server.start()
@duhaime
duhaime / OrbitControls.js
Last active Aug 20, 2019
Low-Poly Scene (Three.js)
View OrbitControls.js
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.OrbitControls = function ( object, domElement ) {
this.object = object;
@duhaime
duhaime / plot-bunnies.ipynb
Last active Aug 1, 2019
plot-bunnies.ipynb
View plot-bunnies.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duhaime
duhaime / dither.ipynb
Created Jul 30, 2019
Floyd-Steinberg Dithering
View dither.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duhaime
duhaime / image-to-points.ipynb
Created Jul 30, 2019
Image to Points: Convert an input image to a series of discrete, uniform-sized points using simple statistical sampling
View image-to-points.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.