Skip to content

Instantly share code, notes, and snippets.

@randy3k
randy3k / num_rows_csv.R
Created Jun 5, 2020 — forked from peterhurford/num_rows_csv.R
What's the fastest way to determine the number of rows of a CSV in R?
View num_rows_csv.R
# What's the fastest way to determine the number of rows of a CSV in R?
# ...Reading the entire CSV to only get the dimensions is likely too slow. Is there a faster way?
# Benchmarks done on a EC2 r3.8xlarge
# Cowritten with Abel Castillo <github.com/abelcastilloavant>
m <- 1000000
d <- data.frame(id = seq(m), a = rnorm(m), b = runif(m))
dim(d)
# [1] 1000000 3
pryr::object_size(d)
@randy3k
randy3k / # rstudio-server - 2020-06-03_00-37-06.txt
Created Jun 3, 2020
rstudio-server (rstudio-server) on Ubuntu 16.04.6 LTS - Homebrew build logs
View # rstudio-server - 2020-06-03_00-37-06.txt
Homebrew build logs for rstudio-server on Ubuntu 16.04.6 LTS
Build date: 2020-06-03 00:37:06
@randy3k
randy3k / # boost-rstudio-server - 2020-06-02_18-07-27.txt
Created Jun 2, 2020
boost-rstudio-server (boost-rstudio-server) on Ubuntu 20.04 LTS - Homebrew build logs
View # boost-rstudio-server - 2020-06-02_18-07-27.txt
Homebrew build logs for boost-rstudio-server on Ubuntu 20.04 LTS
Build date: 2020-06-02 18:07:27
@randy3k
randy3k / # rstudio-server - 2020-06-02_22-36-55.txt
Created Jun 2, 2020
rstudio-server (rstudio-server) on Ubuntu 20.04 LTS - Homebrew build logs
View # rstudio-server - 2020-06-02_22-36-55.txt
Homebrew build logs for rstudio-server on Ubuntu 20.04 LTS
Build date: 2020-06-02 22:36:55
@randy3k
randy3k / server.R
Created Apr 6, 2020
preview private github repo
View server.R
library(httpuv)
library(httr)
library(stringr)
app <- list(
call = function(req) {
paths <- str_split(req$PATH_INFO, "/")[[1]]
owner <- paths[2]
repo <- paths[3]
path <- str_c(paths[4:length(paths)])
@randy3k
randy3k / launcher.cc.diff
Created Feb 14, 2020 — forked from talonsensei/launcher.cc.diff
Diff of launcher.cc from shiny-server showing the changes necessary to make it work on OS X. From https://github.com/nathanweeks/shiny-server/commit/d5240ef6d795dafc89c74a49d6f14d7fe0509541
View launcher.cc.diff
@@ -1,1 +1,1 @@
/*
* launcher.cc
*
* Copyright (C) 2009-13 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
@randy3k
randy3k / app.R
Created Feb 12, 2020
shiny app with splite
View app.R
library(shiny)
library(tidyverse)
library(DBI)
con <- dbConnect(RSQLite::SQLite(), dbname = "mtcars.sqlite")
onStop(function() dbDisconnect(con))
# to create the .sqlite file
# con %>% dbWriteTable("mtcars", mtcars)
@randy3k
randy3k / ucdvpn
Last active Nov 13, 2019
connect ucd vpn via socks proxy
View ucdvpn
echo $UCDSECRET | openconnect -b --juniper -u $UCDUSER --passwd-on-stdin --script-tun --script "ocproxy -D 8080" vpn.library.ucdavis.edu
@randy3k
randy3k / # rstudio-server - 2019-04-22_01-41-36.txt
Created Apr 22, 2019
rstudio-server on Ubuntu 16.04.6 LTS - Homebrew build logs
View # rstudio-server - 2019-04-22_01-41-36.txt
Homebrew build logs for rstudio-server on Ubuntu 16.04.6 LTS
Build date: 2019-04-22 01:41:36
@randy3k
randy3k / pre-commit
Created Aug 30, 2018
git pre-commit which unstages eol whitespaces
View pre-commit
#!/bin/sh
git diff --ignore-space-at-eol -U0 --cached > foo.patch
git reset
git apply --ignore-whitespace --unidiff-zero --cached foo.patch
rm foo.patch
You can’t perform that action at this time.