Experiemental work on forked computation in shiny app using the package "parallel".
Does not work on windows.
/* ******************************************************************************************* | |
* PUPPETEER | |
* https://pptr.dev/ | |
* ******************************************************************************************* */ | |
// When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) | |
// that is guaranteed to work with the API. | |
npm install puppeteer |
#' 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) | |
#' |
"""Extract nested values from a JSON tree.""" | |
def json_extract(obj, key): | |
"""Recursively fetch values from nested JSON.""" | |
arr = [] | |
def extract(obj, arr, key): | |
"""Recursively search for values of key in JSON tree.""" | |
if isinstance(obj, dict): |
exports.scrapeTwittter = async (req, res) => { | |
let ret = []; | |
const { search } = req.query; | |
try { | |
const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] }); | |
const page = await browser.newPage(); | |
await page.goto(`https://twitter.com/search?f=tweets&vertical=default&q=${search}&src=typd`); | |
//set viewport for the autoscroll function | |
await page.setViewport({ | |
width: 1200, |
#current preferred version of wc2 | |
devtools::install_github("Lchiffon/wordcloud2#32") | |
#function to give wordcloud2 click interactivity | |
wc2ClickedWord = function(cloudOutputId, inputId) { | |
#ARGUMENTS | |
# - cloudOutputId: string; outputId of wordcloud2 obj being rendered (should be identical to the value passed to wordcloud2Output) | |
# - inputId: string; inputId of word clicked on (ie you will reference in server the word by input$inputId) | |
#OUPUT | |
# - referencing input in server will return a string of form word:freq (same as hover info shown in wordcloud; ie 'super:32') |
Moved to https://github.com/ebidel/puppeteer-examples/blob/master/monitor_internet_connection.js |
import requests | |
import bs4 | |
import re | |
import json | |
listOfCongress = [] | |
url = 'https://www.govtrack.us/congress/members/current?sort=sortname&page=1&faceting=false&allow_redirect=false&do_search=1' | |
congressCount = requests.get(url).json()['total'] | |
information = {} |
# 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) |