Skip to content

Instantly share code, notes, and snippets.

@kevincolten
kevincolten / lines.html
Created August 12, 2015 16:53
Comparing Consecutively Ran Bokeh Plots
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>line.py example</title>
<link rel="stylesheet" href="bokehjs/build/css/bokeh.css" type="text/css" />
<script type="text/javascript" src="bokehjs/build/js/bokeh.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script>
@kevincolten
kevincolten / post.md
Last active October 24, 2023 00:11
@post Hosting Multiple Repositories With GitHub Pages

GitHub Pages is great for building a personal or project website. It'll default to http://username.github.io, or you can even use your own custom domain name from services like Namecheap, which I will write about in another post soon.

So you set up your GitHub Page for yourself or project, but what if you want to show off some of your other projects you are working on. You can go the poor man's route, and simply just copy everything from another repository into a folder in your username.github.io repository, commit and push the changes to GitHub, and you'll be able to navigate to http://username.github.io/project.

But this comes with some seriously inconvienent and non-conventional drawbacks, such as duplication of code across repositories and manually copy/paste-ing everytime changes are made to update your hosted codebase. Good luck maintaining that.

The other

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kevincolten
kevincolten / notes.md
Last active August 29, 2015 14:26
Notes

brew install mysql

mysql.server start

mysql -uroot

sudo /usr/bin/Weavedssh22.sh start|stop|restart

sudo /usr/bin/Weavedweb80.sh start|stop|restart

@kevincolten
kevincolten / protocol.md
Last active August 29, 2015 14:25
Tornado Sandbox

ClientDataStore operations

Stores actual columns of data on the client. Used by lightweight "data source" models. Supports performing the following CRUD operations.

  • create new columns

  • replace all columns

@kevincolten
kevincolten / post.md
Last active August 29, 2015 14:25
@post Backbone + React: or, How I Came to Stop Looking for an Example and Built My Own

This tutorial came out of many frustrating google searches trying to find a decent end-to-end boilerplate example of incorporating React as the view component in Backbone. The three components I wanted in a tutorial were:

  1. Build something more than a single page TODO
  2. Involved routing and controllers
  3. Included a build process using a modern build tool
  4. Optimization and source-mapping
  5. Done in an organized manner with descriptive naming patterns

What we'll be building in this tutorial is a basic blog viewer. The source can be found here and the finished product can be found here. When complete, we'll be able to write the blog post in markdown in a gist with the title starting with a key word (ex. @post Here's My Post Title!) and display it in all its html glory.

So let's get started.

@kevincolten
kevincolten / ocean_plot.py
Last active August 29, 2015 14:24
Ocean Plot
from bokeh.embed import components
from bokeh.models import AjaxDataSource, Callback, Slider
from bokeh.plotting import figure, output_file, show, vplot
from jinja2 import Template
import webbrowser
import os
import six
source = AjaxDataSource(
data_url='http://54.80.255.253:5000/subsample/0/180/0/360/350/800/0',
@kevincolten
kevincolten / merge_weekly_monthy.py
Last active August 29, 2015 14:23
Download Google Trends
import csv
from collections import deque
with open('weekly_stock_trends.csv', 'rb') as f:
reader = csv.reader(f)
weekly_trends = list(reader)
headers = weekly_trends.pop(0)
new_headers = []
@kevincolten
kevincolten / sparkMySQL.scala
Created June 7, 2015 20:07
Import MySQL into Spark
SPARK_CLASSPATH=../mysql-connector-java-5.1.35/mysql-connector-java-5.1.35-bin.jar bin/spark-shell
val jdbcDF = sqlContext.load("jdbc", Map(
"url" -> "jdbc:mysql://localhost:8889/employees?user=root&password=root",
"dbtable" -> "(SELECT employees.*, departments.*, salaries.salary, titles.title FROM employees JOIN dept_emp ON dept_emp.emp_no = employees.emp_no JOIN departments ON departments.dept_no = dept_emp.dept_no JOIN dept_manager ON dept_manager.emp_no = employees.emp_no JOIN salaries ON salaries.emp_no = employees.emp_no JOIN titles ON employees.emp_no = titles.emp_no) AS employees",
"driver" -> "com.mysql.jdbc.Driver",
"partitionColumn" -> "emp_no",
"lowerBound" -> "10001",
"upperBound" -> "499999",
"numPartitions" -> "10"