This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (InputStreamReader inputStreamReader = new InputStreamReader( | |
new FileInputStream(path.toString()), StandardCharsets.UTF_8)) { | |
// do stuff with the inputStreamReader rather than a File | |
} | |
} | |
byte[] bytes = string.getBytes(StandardCharsets.UTF_8); | |
String string = new String(bytes, StandardCharsets.UTF_8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread.allStackTraces.keySet().each() { | |
if (it.name.contains("SCM polling")) { | |
println "Interrupting thread ${it.id} ${it.name}" | |
it.interrupt() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configure { project -> | |
project / builders / 'hudson.plugins.gradle.Gradle' { | |
description 'Builds and runs unit tests.' | |
tasks "clean test javadoc" | |
rootBuildScriptDir '' | |
fromRootBuildScriptDir true | |
useWrapper true | |
makeExecutable true | |
useWorkspaceAsHome false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a simple function to create a list of lists: | |
list_of_lists <- function(...) { | |
list(...) | |
} | |
my_lol <- list_of_lists(list(cleesh = "krill"), list(nitfol = "rezrov")) | |
# want to print out "krill" and "rezrov" | |
# various suggestions for iterating over a list: | |
for (name in names(my_lol)) { | |
message(my_lol[[name]][[1]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r setup, include=FALSE} | |
devtools::load_all("..") | |
knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>") | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rough code to run mize with various settings over all the test functions in | |
# the funconstrain package https://github.com/jlmelville/mize and | |
# https://github.com/jlmelville/funconstrain | |
# Example | |
# devtools::install_github("jlmelville/mize") | |
# devtools::install_github("jlmelville/funconstrain") | |
# library("mize") | |
# library("funconstrain") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words_canon <- function(words) { | |
words$canon <- apply(words, 1, | |
function(x) { | |
paste( | |
stringr::str_sort( | |
unlist( | |
strsplit( | |
tolower(as.character(x)), split = "", | |
fixed = TRUE))), | |
collapse = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://rorynolan.rbind.io/2018/05/08/rcsetseed/ | |
get_seed <- function() { | |
sample.int(.Machine$integer.max, 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-08-18T16:13:32.193Z","extensionVersion":"v3.4.1"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get copy and paste working | |
sudo apt-get install open-vm-tools-desktop | |
# Activate shared directory: name and define it (e.g. vmshare) in the VM config | |
# On the guest | |
# mkdir -p /mnt/hgfs if necessary | |
sudo vmhgfs-fuse .host:/vmshare /mnt/hgfs/ -o allow_other -o uid=1000 -o nonempty | |
# in /etc/fstab for auto mount | |
.host:/vmshare /mnt/hgfs/vmshare fuse.vmhgfs-fuse defaults,allow_other,uid=1000 0 0 |
OlderNewer