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
#!/bin/bash | |
# look in my /Users/ dir | |
# look for the .Rnw files | |
# suppress the permission denied messages with this: | |
# 2> /dev/null | |
# these are the files to search: | |
FILES=$(find /Users/username -type f -name "*.Rnw" 2> /dev/null) | |
# this is the pattern I want to find within the files |
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
#!/bin/bash | |
ls -lF | grep / | |
# -F = adds '/' to the end of dirs in the list | |
# grep for this | |
# so simple! |
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
#!/bin/bash | |
grep -F Name_to_find *.md | |
# can also use -l to just return the file name | |
# find someone's email address | |
grep -F -e @ *.md | grep name_to_find |
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
plotPCAWithSampleNames = function(x, intgroup="condition", ntop=500) | |
{ | |
library(RColorBrewer) | |
library(genefilter) | |
library(lattice) | |
# pca | |
rv = rowVars(assay(x)) | |
select = order(rv, decreasing=TRUE)[seq_len(min(ntop, length(rv)))] | |
pca = prcomp(t(assay(x)[select,])) |
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
paste0(rep("Sample",times=nrow(tmp_Table)),seq(1:nrow(tmp_Table))) | |
[1] "Sample1" "Sample2" "Sample3" "Sample4" "Sample5" "Sample6" "Sample7" "Sample8" |
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
#!/bin/bash | |
# find all the shell scripts I have written that use the [ ] test function | |
# the [ needs to be escaped! | |
# using xargs | |
find ~/projects/ -type f -name "*.sh" -print0 | xargs -0 grep -l '\[' | |
# using exec | |
find ~/projects/ -type f -name "*.sh" -exec grep -l '\[' {} \; |
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
Had trouble getting iPython, Jupyter, installed after upgrading to El Capitan OS X 10.11 | |
using default pip, packages were getting installed to | |
/Library/Python/2.7/site-packages/ | |
when trying to run `jupyer notebook`, the notebook package was not being found, couldn't run | |
`> jupyter: 'notebook' is not a Jupyter command` | |
uninstalled all packages that were installed to that dir | |
example: |
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
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific aliases and functions | |
### autocorrects cd misspellings, 'cd /sur/src/linus' >> 'cd /usr/src/linux' ### |
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
#!/bin/bash | |
# unzip all files in current directory | |
# extract into new directory of the same name | |
for i in *.zip; do echo $i; echo ${i%.zip}; mkdir ${i%.zip}; unzip ${i} -d ${i%.zip}; done |
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
#!/bin/bash | |
# in OS X | |
find -E . \( ! -regex '.*/\..*' \) | |
# vanilla bash | |
find . \( ! -regex '.*/\..*' \) -type f -name "filename" |