Skip to content

Instantly share code, notes, and snippets.

View zkendall's full-sized avatar

Zack Kendall zkendall

View GitHub Profile
@samie
samie / EmbeddedVaadinCORSServletSample.java
Last active June 19, 2018 06:42
Using CORS with Vaadin
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class)
public static class MyCORSServlet extends VaadinServlet {
/**
* Override to handle the CORS requests.
*/
@Override
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
@zollinger
zollinger / getcolor.py
Last active March 11, 2023 15:57
Simple way to get dominant colors from an image in Python
from PIL import Image, ImageDraw
import argparse
import sys
def get_colors(image_file, numcolors=10, resize=150):
# Resize image to speed up processing
img = Image.open(image_file)
img = img.copy()
img.thumbnail((resize, resize))