Skip to content

Instantly share code, notes, and snippets.

#' Convert degrees to radians
deg2rad <- function(deg){
rads <- deg*pi/180
return(rads)
}
#' Calculates the geodesic distance between two points specified by
#' radian latitude/longitude using the
#' Spherical Law of Cosines (slc)
#'
@CarlBoneri
CarlBoneri / rselenium-taxonomer-1-upload.R
Created June 24, 2019 09:00 — forked from daattali/rselenium-taxonomer-1-upload.R
Use RSelenium to automatically upload many FASTQ files, submit each to "full analysis" when it's ready, and download the analyzed file on Taxonomer.com
# This script uploads all the FAST files to the taxonomer server (only one file can be uploaded at a time)
# Assumes that you have RSelenium package installed and that you've got a simple selenium example to work
if (FALSE) {
fastq_files <- c(
list.files(# WHERE ARE THE FILES?, pattern = "fastq.gz$", full.names = TRUE)
)
login_password <- "" # what is my password???
library(RSelenium)
@CarlBoneri
CarlBoneri / gist:7503cc8ae02f0fb05bb4c8ac29347b3c
Created June 24, 2019 08:58 — forked from alex23lemm/gist:40046aba037bac7b9808
RSelenium: Navigating using the Selenium Server binary / default remoteDriver
# sandbox.R is used to capture intermediate results of potential upcoming
# features which might make it into production.
# Check out the RSelenium package
#
# Load libraries and config file -----------------------------------------------
library(RSelenium)
library(yaml)
<html>
<head>
<!--Import Google Icon Font-->
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Icon and Roboto Fonts -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<!--Import materialize.css-->

title: "SGAA_THANGZ" author: "Carl Boneri" date: "March 20, 2018" output: html_document: highlight: espresso keep_md: yes number_sections: yes theme: spacelab

@CarlBoneri
CarlBoneri / monitor_internet_connection.js
Created January 3, 2018 21:00 — forked from ebidel/monitor_internet_connection.js
Puppeteer: monitor status of internet connectivity using headless Chrome
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*/
// Uses puppeteer and the browser's online/offline events to monitor connection status.
const util = require('util');
const dns = require('dns');
const puppeteer = require('puppeteer');
@CarlBoneri
CarlBoneri / README-Template.md
Created December 21, 2017 12:11 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@CarlBoneri
CarlBoneri / Twitter API with Curl
Created November 9, 2017 02:49 — forked from apolloclark/Twitter API with Curl
Twitter API with Curl
# create an account, create an app
# @see https://apps.twitter.com/
# retrieve the access tokens
# @see https://dev.twitter.com/oauth/reference/post/oauth2/token
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"
@CarlBoneri
CarlBoneri / charset_output.csv
Last active October 27, 2017 04:18
A function to parse the data found on https://dev.w3.org/html5/html-author/charref into a usable reference/index table for R
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"title","rendered_character","icu_category_rgx","icu_block","icu_set","html_char_named","hex_cp","decimal_cp","unicode_cp"
"character tabulation","","Cc","C0 Controls and Basic Latin","mmlextra","&Tab;","&#x00009;","&#9;",""
"line feed (lf)","","Cc","C0 Controls and Basic Latin","mmlextra","&NewLine;","&#x0000A;","&#10;",""
"exclamation mark","!","Po","C0 Controls and Basic Latin","9573-2003-isonum","&excl;","&#x00021;","&#33;","!"
"quotation mark","""","Po","C0 Controls and Basic Latin","predefined xhtml1-special 9573-2003-isonum html5-uppercase","&quot; &QUOT;","&#x00022;","&#34;","\"""
"number sign","#","Po","C0 Controls and Basic Latin","9573-2003-isonum","&num;","&#x00023;","&#35;","#"
"dollar sign","$","Sc","C0 Controls and Basic Latin","9573-2003-isonum","&dollar;","&#x00024;","&#36;","$"
"percent sign","%","Po","C0 Controls and Basic Latin","9573-2003-isonum","&percnt;","&#x00025;","&#37;","%"
"ampersand","&","Po","C0 Controls and Basic Latin","predefined html5-uppercase 9573-2003-isonum","&amp; &AMP;
@CarlBoneri
CarlBoneri / rst_environments.R
Created September 1, 2017 16:27
Global Environment helpers for rstudio
# Environment Utilities ----------------------------------------------
#' Clean all lines out of the console.
#'
#' \code{env.clear_console}
#'
#'
#' Rstudio Server can get really slow if a lot of text, especially unicode
#' or foreign data types are sitting in the GUI. This function is the equiv
#' of \code{Edit > Ctrl + L}
#'