This file contains hidden or 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
# replace all insances of '.' in all columns without changing anything else. | |
dt <- data.frame( | |
a=sample(LETTERS, 10), | |
b=sample(c('.', 1, 2, 3), 10, replace=T), | |
c=sample(c('.', 'rick', 'morty', 'summer'), 10, replace=T)) | |
# print the data.frame | |
dt | |
# use purrr::map_dfc to loop through the columns of the data.frame |
This file contains hidden or 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
# if the 'update manager' isn't working properly then ssh in to OMV with admin account | |
apt-get update && apt-get dist-upgrade && omv-update | |
# to move to next release | |
omv-release-upgrade |
This file contains hidden or 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
grep -c $'$$$$' <filename> |
This file contains hidden or 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
# create babel fastsearch indexes and capture the output | |
find . -name "*20M.smi" -print0 | \ | |
xargs -P 3 -L 1 -0 -I{} sh -c 'babel "$1" -ofs &> "$1.log"' -- {}) |
This file contains hidden or 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
grep("orange", color()) |
This file contains hidden or 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
[Enter] | |
~. |
This file contains hidden or 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
#!/bin/bash -eu | |
CV_FOLDS=5 | |
while read mol_name label; do | |
FOLD=$(( (RANDOM % $CV_FOLDS) + 1)); | |
echo -e "mol_name\tlabel\t$FOLD"; | |
done |
This file contains hidden or 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
#!/bin/bash -eu | |
n=100 | |
m=5 | |
for i in $(seq 1 $n); do | |
echo $(( (RANDOM % $m) + 1)); | |
done |
This file contains hidden or 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
# generates the list of user installed packages and prints out the name and version number | |
user_packages <- as.data.frame(installed.packages(priority="NA"), stringsAsFactors=F) | |
print(unique(user_packages[c('Package', 'Version')]), row.names=F) |
This file contains hidden or 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
# list the files in the index that are ignored via patterns in .gitignore | |
git ls-files -i --exclude-from=.gitignore | |
# remove these files - assuming filenames with no spaces or special characters | |
git rm --cached $(git ls-files -i --exclude-from=.gitignore) | |
# remove these files - assuming filenames with spaces (urgh!) | |
git ls-files -i --exclude-from=.gitignore -z | xargs -0 git rm --cached |
NewerOlder