Skip to content

Instantly share code, notes, and snippets.

Avatar

Greg Lamp glamp

  • Boulder, CO
View GitHub Profile
View scrapy-error.log
Packing version 98c8d04-master
Deploying to Scrapy Cloud project "373200"
Deploy log last 3 lines:
{"message": "500 Server Error: Internal Server Error for url: https://kumo-builder-prod.dc21.scrapinghub.com:2376/v1.27/auth", "error": "internal_error"}
View scikit-example.py
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier()
target_variable = 'does-make-more-than-50k'
columns = ['age', 'education', 'hours-worked-per-week']
clf.fit(df[columns], df[target_variable])
@glamp
glamp / docker-compose.yml
Created Apr 2, 2018
Docker compose file for Wordpress.
View docker-compose.yml
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- dbdata:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
View idledark.vim
" Generated by Color Theme Generator at Sweyla
" http://sweyla.com/themes/seed/690000/
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
View .vim-colors-idledark.vim
" Generated by Color Theme Generator at Sweyla
" http://sweyla.com/themes/seed/690000/
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
View yhat-scienceops-cleanup.sh
#!/usr/bin/env bash
# make sure the user running this script has permission to run docker
docker ps > /dev/null
# remove "<none>" images
docker rmi -f $(docker images | grep none | awk '{ print $3 }')
# cleanup exited containers
docker rm -f $(docker ps -f status=exited -q)
View imdb_fasttext.py
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Flatten
from keras.layers import Embedding
from keras.layers import AveragePooling1D
from keras.datasets import imdb
View election-map-plots.R
library(XML)
library(uuid)
library(stringr)
library(plyr)
library(reshape2)
library(ggplot2)
f <- "https://raw.githubusercontent.com/chris-taylor/USElection/master/data/electoral-college-votes.csv"
electoral.college <- read.csv(f, header=FALSE)
names(electoral.college) <- c("state", "electoral_votes")
View get-election-data.R
library(plyr)
library(XML)
library(uuid)
library(reshape2)
results <- ldply(states, function(state) {
url <- "http://www.electionprojection.com/latest-polls/%s-presidential-polls-trump-vs-clinton-vs-johnson-vs-stein.php"
state.fmt <- gsub(" ", "-", tolower(state))
url.state <- sprintf(url, state.fmt)
View example-split-with-submodels.py
from yhat import Yhat, YhatModel
import numpy as np
class SplitTestExample(YhatModel):
def execute(self, data):
# randomly select model to use. `p` defines the split percentage
endpoints = ["ModelA", "ModelB"]
endpoint = np.random.choice(endpoints, p=[0.2, 0.8])
# make prediction to a "sub-model". this will give you back the full API response
You can’t perform that action at this time.