Skip to content

Instantly share code, notes, and snippets.

Ron Richardson rer145

Block or report user

Report or block rer145

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
@rer145
rer145 / setup_scala.sh
Created Mar 28, 2018
Setting up Scala on Google Cloud Shell
View setup_scala.sh
#!/bin/bash
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
@rer145
rer145 / latex_slides.Rnw
Last active Nov 20, 2017
Creating a slide presentation with beamer and latex
View latex_slides.Rnw
\documentclass{beamer}
\begin{document}
\title{Positive and Negative Words in Dracula}
\author{Ron Richardson}
\begin{frame}
\titlepage
@rer145
rer145 / wordcloud2.R
Created Nov 16, 2017
Using wordcloud2 to make dynamic wordclouds
View wordcloud2.R
library(gutenbergr)
library(tidytext)
library(dplyr)
library(wordcloud2)
dracula<-gutenberg_download(345)
dracula$gutenberg_id<-NULL
dracula<-dracula%>%
unnest_tokens(word, text)
@rer145
rer145 / comparision_cloud.R
Last active Nov 16, 2017
Creating a comparison cloud in R with wordcloud
View comparision_cloud.R
library(gutenbergr)
library(tidytext)
library(dplyr)
library(wordcloud)
dracula<-gutenberg_download(345)
dracula$gutenberg_id<-NULL
dracula<-dracula%>%
unnest_tokens(word, text)
@rer145
rer145 / ggplot_facet_wrap.R
Created Nov 11, 2017
Using facet_wrap in ggplot to compare plots side by side.
View ggplot_facet_wrap.R
# Import the libraries used
library(gutenbergr)
library(tidytext)
library(dplyr)
library(ggplot2)
# Download text from Project Gutenberg
dracula<-gutenberg_download(345)
# Split the lines of text into words
@rer145
rer145 / basic_unittest.py
Created Nov 8, 2017
How to do a simple unit test in python
View basic_unittest.py
# Our function to test
def above_freezing(celcius):
""" (int) -> boolean
Return True if celcius is above zero, and False if not
"""
return celcius > 0
@rer145
rer145 / positive_dracula.R
Last active Nov 8, 2017
How to plot the top 10 positive words in a large set of text
View positive_dracula.R
library(gutenbergr)
library(tidytext)
library(dplyr)
library(ggplot2)
# Using Dracula as our example text, download it from Project Gutenberg
dracula<-gutenberg_download(345)
# Split each line of text into individual words
dracula<-dracula%>%
@rer145
rer145 / python_sorting.py
Last active Nov 11, 2017
Different sorting methods in python
View python_sorting.py
def bubble_sort(L):
for i in range(len(L)-1, 0, -1):
for j in range(i):
if L[j] > L[j+1]:
temp = L[j]
L[j] = L[j+1]
L[j+1] = temp
def selection_sort(L):
@rer145
rer145 / file_prompts.py
Created Nov 7, 2017
Input and output file prompts in python
View file_prompts.py
import os.path
def input_file_prompt():
""" () -> string
Precondition: none
This function returns back a filename that the user wants to read data from. It also checks to see
if the file already exists and if not, informs the users and prompts them to try again.
@rer145
rer145 / sentiments.R
Created Nov 7, 2017
How to match word sentiments to words with R
View sentiments.R
library(dplyr)
library(tidytext)
library(gutenbergr)
library(ggplot2)
# Get our data, the text of Frankenstein
dracula<-gutenberg_download(345)
# Remove the gutenberg_id field since we don't need it
dracula$gutenberg_id<-NULL
You can’t perform that action at this time.