In ksh only (not in bash), this just works:
printf '%#d\n' 105000000
105M
Even this!!!
| #!/bin/bash | |
| set -e | |
| usage="$(basename "$0") [-h] [-i PROJECT] [-v VM] [-p PYTHON] [-d NOTEBOOKS] | |
| Make a user provide SSH key and jupyter notebooks (in roles/bootstrap/files/notebooks) to each user listed in var/common.yml | |
| where: | |
| -h show this help text | |
| -i google cloud project id | |
| -v name of instance/virtual machine | |
| -p python path |
| Generate checksums for many files in a directory | |
| ``` | |
| # make checksums (use md5 on macos) | |
| find ./some_dir -type f -exec md5sum {} \; >> checksums.md5 | |
| # check them | |
| md5sum -c checksums.md5 | |
| # use gnu parallel for really many files? Much faster |
In ksh only (not in bash), this just works:
printf '%#d\n' 105000000
105M
Even this!!!
| # demonstrate Leaflet.hotline JS plugin in leaflet for R | |
| library(leaflet) | |
| library(htmlwidgets) | |
| library(htmltools) | |
| #library(mapview) | |
| # the Leaflet.hotline plugin has to be locally downloaded |
| # this code is about | |
| # reading fcs files (from FACS) and converting them to one dataframe | |
| # plotting is then done normally in ggplot | |
| # installation instructions for the required libraries can be found on the internet:) | |
| library(flowCore) | |
| library(tidyverse) | |
| ### this function reads a fcs file and returns the data as a tibble, adding a column with the file name ##### |
| # these two functions perform the following: | |
| # do_drm() --> performs drm (from the drc package) on a long dataframe, using the LL.4 log-logistic model for describing dose-response relationships | |
| # do_drm_plot() --> plots the output of do_drm() | |
| # to use the functions just paste this file in your R session and source it. | |
| # try it out with | |
| # do_drm(S.alba, Dose, DryMatter, Herbicide) %>% do_drm_plot(ed50 = TRUE, color = ~Herbicide) + scale_x_log10() | |
| ##===================== | |
| # do_drm() usage | |
| # do_drm(df, d, r, x, y, ...) |
| # the aim is to use the 'drc' package to fit models to data and then extract the data and use for plotting in ggplot | |
| # the data could be growth curves, dose-response, Michaelis-Menten etc. | |
| # here, the S.alba data from drc is used for dose-response | |
| library(tidyverse) | |
| library(broom) | |
| library(drc) | |
| library(modelr) | |
| attach(S.alba) # the data used in this gist | |
| library(egg) |
| # a general function for plotting linear models | |
| # makes plots of the data and the model plus the model coefficients | |
| # the function takes a linear model object as argument | |
| ggplotLM <- function(fit) { | |
| require(ggplot2) | |
| require(broom) |
| library(ggplot2) | |
| library(dplyr) | |
| library(reshape2) | |
| #df | |
| n <- as.integer(grep("Header", readLines("ASCIIData.txt")) %>% length()) # number of runs, without the system call above | |
| ole <- readline(prompt="Enter number of olefins detected for these runs(including C30): ") | |
| ole <- as.integer(ole) |