Skip to content

Instantly share code, notes, and snippets.

@CarlBoneri
CarlBoneri / gist:80a1657f98c701bfb8ac6e0cbe1dce0e
Created March 18, 2020 23:54 — forked from rafaan/gist:4ddc91ae47ea46a46c0b
Convert Nested JSON to Pandas DataFrame and Flatten List in a Column
import json
from pandas.io.json import json_normalize
import pandas as pd
with open('C:\filename.json') as f:
data = json.load(f)
df = pd.DataFrame(data)
normalized_df = json_normalize(df['nested_json_object'])
@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)
@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 / twitter.js
Created September 9, 2016 15:36 — forked from cjoudrey/twitter.js
Lazy-rendering in PhantomJS
// This example shows how to render pages that perform AJAX calls
// upon page load.
//
// Instead of waiting a fixed amount of time before doing the render,
// we are keeping track of every resource that is loaded.
//
// Once all resources are loaded, we wait a small amount of time
// (resourceWait) in case these resources load other resources.
//
// The page is rendered after a maximum amount of time (maxRenderTime)