Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusmota committed Sep 1, 2019
0 parents commit 63ae84b
Show file tree
Hide file tree
Showing 30 changed files with 1,406 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
4 changes: 4 additions & 0 deletions binder/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
htop
vim
curl
wget
5 changes: 5 additions & 0 deletions binder/install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
install.packages("tidyverse")
install.packages("rmarkdown")
install.packages("httr")
install.packages("shinydashboard")
install.packages('leaflet')
52 changes: 52 additions & 0 deletions binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

###############################################################
# jupyter/jupyterlab extensions/kernels #
###############################################################

# sos installation
python -m sos_notebook.install
jupyter labextension install jupyterlab-sos --no-build

# Beaker installation and extension
beakerx install
jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
jupyter labextension install beakerx-jupyterlab --no-build

# Git Jupyter/Lab extension
jupyter labextension install @jupyterlab/git --no-build
jupyter serverextension enable --py jupyterlab_git

# Jupyter/Lab extension for iframe/url https://github.com/timkpaine/jupyterlab_iframe
jupyter labextension install jupyterlab_iframe --no-build
jupyter serverextension enable --py jupyterlab_iframe

# Github Jupyter Lab extension
jupyter labextension install @jupyterlab/github --no-build

# Draw.io Jupyter Lab extension
jupyter labextension install jupyterlab-drawio --no-build

# Rise Jupyter extension (presentation mode)
jupyter-nbextension install rise --py --sys-prefix
jupyter-nbextension enable rise --py --sys-prefix

# Plotly Jupyter Lab extension
jupyter labextension install @jupyterlab/plotly-extension --no-build

# Table of contents Jupyter Lab Extension
jupyter labextension install @jupyterlab/toc --no-build

# Jupyter/Jupyterlab extension for proxying internal applications
jupyter serverextension enable --sys-prefix jupyter_server_proxy
jupyter labextension install jupyterlab-server-proxy

# JupyterLab extension mimerenderer to render HTML files in IFrame Tab. https://github.com/mflevine/jupyterlab_html
jupyter labextension install @mflevine/jupyterlab_html --no-build

# Building everything up
jupyter lab build --dev

###############################################################
# /jupyter/jupyterlab extensions/kernels #
###############################################################
25 changes: 25 additions & 0 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
###############################################################
# jupyter/jupyterlab extensions/kernels #
###############################################################
# beakerx (kernels: java, clojure, groovy, scala, kotlin, sql) and dependencies
beakerx
py4j

# sos - script of scripts (multiple kernels)
sos
sos-notebook

#jupyter/jupyterlab extensions
jupyterlab
jupyter_contrib_nbextensions
jupyterlab_launcher
jupyterlab-git
jupyterlab_iframe
ipywidgets
RISE

jupyter-server-proxy

###############################################################
# /jupyter/jupyterlab extensions/kernels #
###############################################################
1 change: 1 addition & 0 deletions binder/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
r-2019-04-10
12 changes: 12 additions & 0 deletions labs/lab1.shiny/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Shiny Bus Dashboard example

This example is taken straight from https://github.com/rstudio/shiny-examples/tree/master/086-bus-dashboard. Which is licensed under the MIT license.

The script in the `metrotransit-data/` directory will fetch schedule data for the Twin Cities Metro Transit. This data is updated weekly.


The 00-fetch-data.R script should be executed in the `metrotransit-data/` directory. It fetches the data and saves some of the tables as .rds files. The bus app will read in the .rds files for route information.

Information about schedule data: http://datafinder.org/metadata/transit_schedule_google_feed.html

Data format reference: https://developers.google.com/transit/gtfs/reference?csw=1
3 changes: 3 additions & 0 deletions labs/lab1.shiny/metrotransit-data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Rproj.user
.Rhistory
.RData
41 changes: 41 additions & 0 deletions labs/lab1.shiny/metrotransit-data/00-fetch-data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Information about data source at:
# http://datafinder.org/metadata/transit_schedule_google_feed.html

# Data reference:
# https://developers.google.com/transit/gtfs/reference?csw=1

# These are the data files we want to use
datafiles <- c("shapes.txt", "trips.txt")

# =============================================================================
# Download and unzip data
# =============================================================================
download.file("ftp://gisftp.metc.state.mn.us/google_transit.zip",
"google_transit.zip")

dir.create("raw", showWarnings = FALSE)

# Extract just the specified data files
unzip("google_transit.zip", files = datafiles, exdir = "raw")
unlink("google_transit.zip")

# =============================================================================
# Read in each of the data objects and save to an RDS file
# =============================================================================
# Clean out old files
unlink("rds", recursive = TRUE)

dir.create("rds", showWarnings = FALSE)

for (datafile in datafiles) {
infile <- file.path("raw", datafile)
outfile <- file.path("rds", sub("\\.txt$", ".rds", datafile))

cat("Converting ", infile, " to ", outfile, ".\n", sep = "")

obj <- read.csv(infile, stringsAsFactors = FALSE)
saveRDS(obj, outfile)
}

# Remove raw data files
unlink("raw", recursive = TRUE)
15 changes: 15 additions & 0 deletions labs/lab1.shiny/metrotransit-data/metrotransit-data.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
Binary file added labs/lab1.shiny/metrotransit-data/rds/shapes.rds
Binary file not shown.
Binary file added labs/lab1.shiny/metrotransit-data/rds/trips.rds
Binary file not shown.
Loading

0 comments on commit 63ae84b

Please sign in to comment.