Skip to content

Instantly share code, notes, and snippets.

@herbps10
herbps10 / admin.py
Created June 18, 2015 14:04
Setting up SQLAlchemy with Application Factory pattern and Blueprints
from flask import current_app, Blueprint, render_template
from database import db_session
from model import Product
admin = Blueprint('admin', __name__, url_prefix='/admin')
@admin.route('/')
def index():
product = db_session.query(Product).first()
@herbps10
herbps10 / raytracer.sh
Created October 22, 2016 00:10
Bash Ray Tracer
#!/bin/bash
#
#
# Bash Raytracer
# Herb Susmann
#
PIXEL_INCR="0.05"
# Object type IDs
@herbps10
herbps10 / .block
Last active October 25, 2016 18:28
IQ Distribution Master
license: mit
@herbps10
herbps10 / .block
Last active November 3, 2016 19:24
IQ Distribution Mean/SD Slider
license: mit
border: no
@herbps10
herbps10 / .block
Last active November 14, 2016 16:52
IQ
license: mit
@herbps10
herbps10 / .block
Last active November 3, 2016 19:39
IQ with comparison
license: mit
@herbps10
herbps10 / .block
Created November 3, 2016 19:22
fresh block
license: mit
@herbps10
herbps10 / twitter-cloud.R
Created December 7, 2016 15:43
Twitter word cloud
library(tidyverse)
library(tm)
library(SnowballC)
library(wordcloud)
library(RColorBrewer)
setup_twitter_oauth(consumer_key = "...", consumer_secret = "...")
results <- searchTwitter("#EHSFEST", n = 1000) %>%
twListToDF()
@herbps10
herbps10 / twitter-bulk-add-to-list.R
Last active December 8, 2016 16:54
Twitter Bulk Add to List
#
# Adds twitter users to a twitter list in bulk
#
library(twitteR)
query <- "#EHSFEST"
screen_name <- "herbps10"
list_slug <- "ehsfest"
setup_twitter_oauth(consumer_key = "...", consumer_secret = "...")
@herbps10
herbps10 / package-downloads.R
Last active February 25, 2018 15:15
R Package Download Graph
library(tidyverse)
log <- cranlogs::cran_downloads(packages="RNHANES", from="2016-09-28")
ggplot(log, aes(x = date, y = cumsum(count))) + geom_point()
sum(log$count)