Skip to content

Instantly share code, notes, and snippets.

View jackwasey's full-sized avatar

Jack Wasey jackwasey

  • Children's Hospital of Philadelphia
  • Pennsylvania, USA
View GitHub Profile
@jackwasey
jackwasey / ubuntu-vnc-activate-remote.sh
Created June 19, 2020 21:36 — forked from samba/ubuntu-vnc-activate-remote.sh
Activate VNC support in Ubuntu, from command-line (for active sessions)
#!/bin/sh
# This assumes you have access to the system via SSH already, and need
# remote VNC access as the same user, and you want only the primary display.
export DISPLAY=:0
# Encoded password with http://www.motobit.com/util/base64-decoder-encoder.asp
export VNC_PASSWORD="dm5jX3Bhc3N3b3JkNzE=" # vnc_password71
export VNC_PASSWORD="dm5jX3Bhc3M=" # vnc_password (a character limit is enforced?)
# Sadly many common VNC clients don't support encryption.

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@jackwasey
jackwasey / fastmatch-demo.r
Last active May 25, 2018 20:28
benchmark fastmatch for string comparison in R
library(fastmatch)
library(microbenchmark)
WORDS <- read.table("https://dotnetperls-controls.googlecode.com/files/enable1.txt",
stringsAsFactors = FALSE)[[1]]
words_factor <- as.factor(WORDS)
# generate 100 sentences of between 5 and 15 words:
SENTENCES <- lapply(c(1:100), sample, x = WORDS, size = sample(c(5:15), size = 1))
//' @title Sort using STL
//' @description if compiler flags and standard library support is available
//' (only tested on glibc), OpenMP, then this will use a parallel sort
//' algorithm which is significantly faster. It doesn't however deal with NA
//' values. TODO: handle NA values.
//' @param x vector of strings. In the current implementation, NA is completely
//' ignored, so is probably converted to "NA"
//' @examples
//' \dontrun{
@jackwasey
jackwasey / gist:7beb8fdc5449cf760aac
Created January 6, 2015 13:21
lintr allowing camel case
lintr::lint_package(linters = lintr::default_linters[names(lintr::default_linters) != "object_camel_case_linter"])
@jackwasey
jackwasey / testCoverage.R
Last active August 29, 2015 14:02
test coverage for an R package
#' @title list all functions in a package
#' @param pkg character string containing package name
#' @return character vector of functions in given package
#' @export
lsf <- function(pkg) {
envirName <- paste("package", pkg, sep = ":")
everything <- ls(pos = envirName, all.names = TRUE)
funcs <- c()