Skip to content

Instantly share code, notes, and snippets.

Jameson Toole jamesonthecrow

Block or report user

Report or block jamesonthecrow

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
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body{
font-family: sans-serif;
}
#container {
width: 1000px;
margin: 50px auto;
@jamesonthecrow
jamesonthecrow / index.html
Last active Dec 26, 2016
A visualization to explore timeseries of MIT wifi network data.
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MIT Wifi - Timeseries</title>
<link rel="stylesheet" href="styles.css">
<style>
View calles_update
{
"metadata": {
"name": "Trip Tables"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@jamesonthecrow
jamesonthecrow / RouterChecks
Last active Aug 29, 2015
Calles Router Figures
View RouterChecks
{
"metadata": {
"name": "RouterChecks"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@jamesonthecrow
jamesonthecrow / turicreate_not_hotdog_medium_post.py
Last active Feb 15, 2018
Code snippets for the Medium post on building Not Hotdog with Turi Create
View turicreate_not_hotdog_medium_post.py
import requests
import shutil
import os
def download_images(url_filename, out_directory, max_urls=None):
"""Download images from a file containing URLS.
The URL file must contain a single URL per line.
Args:
@jamesonthecrow
jamesonthecrow / time_func.py
Last active Feb 28, 2018
Benchmarking neural networks in python
View time_func.py
def time_func(function, func_args=None, func_kwargs=None):
"""Time a single call of a function.
Args:
function (function): a function object to time
func_args (list, optional): the args for the function
func_kwargs (dict, optional): the kwargs for the function
Returns:
double: duration of the function call in sections
"""
args = func_args or []
@jamesonthecrow
jamesonthecrow / timePredict.swift
Last active Feb 28, 2018
Benchmarking neural networks in Swift.
View timePredict.swift
struct Debug {
struct Timer {
let start = DispatchTime.now().uptimeNanoseconds
func end() -> Double {
let end = DispatchTime.now().uptimeNanoseconds
let diff = Double(end — start) / 1_000_000_000
return diff
}
}
}
@jamesonthecrow
jamesonthecrow / fritz_style_transfer_template.sh
Last active Dec 26, 2018
Train a Fritz Style Transfer model with a custom style image in 20 minutes. Create Core ML and TensorFlow Mobile versions for use in your app. More information at https://fritz.ai.
View fritz_style_transfer_template.sh
# A script to train an artistic style transfer model from a custom style image.
# A Google Colab going through the same steps can be found here:
# https://colab.research.google.com/drive/1nDkxLKBgZGFscGoF0tfyPMGqW03xITl0#scrollTo=V33xVH-CWUCs
# Note that this script will download and unzip 1GB of photos for training.
# Make sure you have the appropriate permissions to use any images.
# CHANGE ME BEFORE RUNNING
STYLE_IMAGE_URL='STYLE_IMAGE_URL'
# Install requirements
@jamesonthecrow
jamesonthecrow / inference_subreddit_suggester.swift
Last active Nov 11, 2018
Incorporate the subreddit suggester into your iOS app.
View inference_subreddit_suggester.swift
// Drag your subredditClassifier.mlmodel to the Xcode project navigator.
// Use the model with the following code.
import NaturalLanguage
let subredditPredictor = try NLModel(mlModel: subredditClassifier().model)
subredditPredictor.predictedLabel(for: "TIL you can use Core ML to suggest subreddits to users.")
@jamesonthecrow
jamesonthecrow / subreddit_suggester_preprocess_data.py
Created Nov 11, 2018
Preprocess data for the subreddit suggester.
View subreddit_suggester_preprocess_data.py
import pandas
import re
import json
# Use pandas and regex to clean up the post titles.
df = pandas.DataFrame(posts, columns=['subreddit', 'title'])
# Remove any [tag] markers in a post title
df.title = df.title.apply(lambda x: re.sub(r'\[.*\]', '', x))
# Remove all other punctuation except spaces
df.title = df.title.apply(lambda x: re.sub(r'\W(?<![ ])', '', x))
You can’t perform that action at this time.