Skip to content

Instantly share code, notes, and snippets.

View chipoglesby's full-sized avatar
🏠
Working from home

Chip Oglesby chipoglesby

🏠
Working from home
View GitHub Profile
bootstrap.list <- c("car",
"codetools",
"colorspace",
"data.table",
"devtools",
"dplyr",
"forecast",
"ggplot2",
"knitr",
"lattice",
@MarkEdmondson1234
MarkEdmondson1234 / processTweets.r
Last active August 29, 2015 14:02
A couple of functions used to process Tweets after fetching
### tweetdata.r
### Fetch Twitter data and Data Transformations
### Requires you have authenticated in auth.R
### 15th June 2014
### Mark Edmondson @HoloMarkeD
###
### For use with Twitter API, processTweets() takes the df$tweetDF data.frame as input
### And calculates/transforms data for the plots
processTweets <- function(tweetDF,
### plotTweets.r
### Plot out tweets
### Requires you have authenticated in auth.R and processed in tweetdata.R
### 15th June 2014
### Mark Edmondson @HoloMarkeD
###
library(ggplot2)
######################################################################
@sckott
sckott / bitly_r.md
Last active August 29, 2015 14:07
Querying bitly from R

Querying bitly from R

library('httr')
btoken <- '<token>' # go to https://bitly.com/a/oauth_apps and generate token
args <- list(query='obama', domain='nytimes.com', limit=2, access_token = btoken)
req <- GET("https://api-ssl.bitly.com/v3/search", query=args) 
content(req)
### Function for generating the posterior of Robo's position ###
landscape <- c(rep("plain", 50), rep("mountain", 25), rep("forest", 45))
landscape_color <- c(mountain = "black", forest = "green", plain = "yellow")
cover_cost <- c(mountain = 10, forest = 5, plain = 1)
posterior_sample <- function(n) {
dist_i <- sample(3, n, replace = TRUE, c(18, 17, 65))
mu <- c(15, 40, 90)
x <- c(
'knitr', # A general-purpose package for dynamic report generation in R.
# 'sqldf', # For running SQL statements on R data frames, optimized for convenience.
'randomForest', # Classification and regression based on a forest of trees using random inputs.
'arm', # R functions for processing lm, glm, svy.glm, mer and polr outputs.
'ggplot2', # An implementation of the Grammar of Graphics.
'gridExtra', # misc. high-level Grid functions
'plyr', # Tools for splitting, applying and combining data.
'tree', # Classification and regression trees.
'gbm', # Generalized Boosted Regression Models
/***********
* Collects the reporting results from all accounts
* and generates a nicely formatted email. If there
* are errors for an account, it includes those
* in the email as well since an error in one account
* won't stop the entire script.
***********/
function generateReport(results) {
var NOTIFY = ['your_email@example.com'];
var total_deleted = 0;
@russorat
russorat / gist:7446125
Created November 13, 2013 09:21
AdWords Script to check sitelinks
function main() {
Logger.log('AdWordsApp.extensions().sitelinks() list.');
logSitelinks(AdWordsApp);
Logger.log('Campaign and AdGroup list.');
var campIter = AdWordsApp.campaigns().get();
while(campIter.hasNext()) {
var camp = campIter.next();
logSitelinks(camp);
var agIter = camp.adGroups().get();
@MarkEdmondson1234
MarkEdmondson1234 / r-installation-debain-wheezy
Last active February 10, 2016 14:43
Installation of R, Rstudio, OpenCPU on GCE Debain Wheezy image, details on how to in the blogpost http://markedmondson.me/run-r-rstudio-and-opencpu-on-google-compute-engine-free-vm-image
### r-installation-debain-wheezy
#### setup commands to setup R, RStudio and OpenCPU on a Google Compute Engine Wheezy instance
#### Mark Edmondson 29 June 2014
##
## No original work, all taken from these sources:
## https://github.com/jeroenooms/opencpu-deb/blob/master/build-on-debian.md
## https://support.rstudio.com/hc/communities/public/questions/200651456-RStudio-server-not-installable-on-Debian-Wheezy-just-released-this-week-
## http://cran.r-project.org/bin/linux/debian/README.html
# need to be sudo for all below
@tra38
tra38 / spintax.rb
Last active July 18, 2016 16:24
This is a script to 'unspin' a spintax-generated blog post about templating
require 'spintax_parser'
class String
include SpintaxParser
end
spintext = %{
>"Templates may seem like a terrible way to produce sentences until you consider the alternatives." --[Chris Pressey](https://github.com/dariusk/NaNoGenMo-2015/issues/16)
{How can you|Is it possible to|How on earth do you} {build|create|come up with|compose} an {algorithm|program} {to build|to create|for making} 'human-readable' novels? While {there was|there has been} [several](https://en.wikipedia.org/wiki/Just_This_Once) [attempts](https://en.wikipedia.org/wiki/Racter) made, {people|individuals|humans|human beings} {never|has not|has not yet|haven't} {reached|arrived at|spotted|located|stumbled on|found} a good "answer" {to that particular|to this} question... yet.