Skip to content

Instantly share code, notes, and snippets.

@haojian
haojian / gist:4f5183db8739de5eadf0
Created May 26, 2015 23:14
write text on images
import os
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
def list_files(path):
# returns a list of names (with extension, without full path) of all files
# in folder path
files = []
for name in os.listdir(path):
@haojian
haojian / circle packing
Created July 19, 2015 05:01
circle packing
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Circle packing"
]
},
{
@haojian
haojian / secret_garden.py
Created August 12, 2015 22:42
secret garden
import skimage;
from skimage import data
from skimage.filters import threshold_otsu
from skimage.segmentation import clear_border
from skimage.measure import label
from skimage.morphology import closing, square
from skimage.measure import regionprops
from skimage.color import label2rgb
import cv2
import numpy as np
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# elasticplay"
]
},
{
@haojian
haojian / gist:054902f6886de32c4ca8
Last active February 29, 2016 05:59
elastic_play
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"#### Problem definition:\n",
"\n",
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@haojian
haojian / .block
Created March 27, 2018 22:36
Vega-Lite Bl.ocks example
license: bsd-3-clause
@haojian
haojian / main.js
Created December 8, 2020 20:12
google map api
var autocomplete;
//Google Maps section //
function initMap() {
var initialMapCenter = { lat: 40.440624, lng: -79.995888};
var parsedTrip = JSON.parse(localStorage.getItem('trip'));
if(parsedTrip && parsedTrip["mapcenter"] !== undefined) {
initialMapCenter = parsedTrip["mapcenter"];
}
const map = new google.maps.Map(document.getElementById("map"), {