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
#Looking for a fast way to find the N minimum values in a vector of values. For use in finding nearest neighbors when one already has a (large) distance matrix. | |
x <- runif(5000) | |
n <- 3 | |
system.time({ # What I'm using now | |
for(i in 1:10000) { | |
a <- sort(x)[1:n] | |
b <- match(a, x) | |
} |
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 | |
text=`cat` | |
echo -E $text | grep -o '@\w*' | sort -n | uniq | sed -n 's/@\(.*\)/\\citation\{\1\}/p' >> ~/smallbib.aux | |
bibtool --preserve.key.case=on -s -d -x ~/smallbib.aux /Users/noamross/Dropbox/Public/library.bib -o ~/smallbib.bib | |
echo -E "$text" | pandoc -f markdown -t html --smart --mathjax --bibliography=/Users/noamross/smallbib.bib --csl=/Users/noamross/Dropbox/Public/pd/ecology.csl --template=/Users/noamross/Dropbox/Public/pd/noam.html --base-header-level=2 | |
rm ~/smallbib.* |
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 | |
filename="$TM_FILEPATH" | |
basename="${filename%.*}" | |
text=`cat ` | |
echo -E $text | grep -o '@\w*' | sort -n | uniq | sed -n 's/@\(.*\)/\\citation\{\1\}/p' >> ~/smallbib.aux | |
bibtool --preserve.key.case=on -s -d -x ~/smallbib.aux /Users/noamross/Dropbox/Public/library.bib -o ~/smallbib.bib |
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
javascript:(function() {window.location=window.location.toString().replace(/^http:\/\/www\.jstor\.org\/stable\/.*\/(.*?)$/,'http://www.jstor.org/stable/pdfplus/$1.pdf?acceptTC=true');}()) |
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 | |
# This script is set to run any time a new file is added to my "Papers" folder, using launchd | |
# 1 - Find papers with JSTOR or Science cover sheets and remove the first page | |
text1="kind:pdf Your use of the JSTOR archive indicates your acceptance of" #JSTOR papers | |
text2="kind:pdf is published weekly, except the last week in December" #Science papers | |
#Add more of these as you find text snippets that identify cover sheets from different publishers. Then add more loops belo |
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
using terms from application "Quicksilver" | |
on process text _bashcom | |
do shell script "/bin/bash -ic '" & _bashcom & "'" | |
end process text | |
end using terms from |
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
# Save this in ~/Libary/Application Support/Quicksilver/Actions and relaunch | |
# Quicksilver. Then just enter a text bash command and activate "BashGrowl" in | |
# the second pane. I like it for todo.txt and system status calls. | |
using terms from application "Quicksilver" | |
on process text theCommand | |
set _text to do shell script "/bin/bash -ic " & quoted form of theCommand | |
try | |
tell application "System Events" |
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 example functions ## | |
## R. Peek ([email protected]) ## | |
## 11-02-2012 ## | |
print.functions <- function(){ | |
cat("Rounding etc.:\n",sep="") | |
cat("---------\n",sep="") | |
cat("roundup(x, numdigits=0) - correct rounding of .5 etc.\n",sep="") | |
cat("round.largest(x) - round to largest digit, i.e., 54 -> 50 \n",sep="") |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 35 in line 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
#Data provided for purpose of R example only. Not for other use without permission. Contact Rosemary Hartman (rosehartman at gmail dot com.) | |
lake.ID,name,treatment,shorline,sizehectars,elevation,fish.y.n,fish.breeding,BUBO.breeding,PSRE.breeding,TAGR.present,RACA.present,RACA.breeding,adult.RACA,YOPY.RACA,meta.RACA,RACA.eggs,RACA.larvae,veg.extent,transect.with.veg,ave.0.1m,ave.0.5m,ave.1m,bank.slope,pH,LGWD,SMWD,silt.0.1,silt.total,area.10cm,vegetated.area,near.type,count.RACApops.1K,count.lakes1K,weighted.dist | |
533,East Boulder,Co,1356.4,11.4,2034.8448,y,y,y,y,n,y,y,6,2,0,0,350,2.28,0.292,0.722916667,5.016666667,10.68333333,0.092475736,8.1,0,0.0417,0.376,0.3472,980.56,3092.59,RACA,5,10,0.8268 | |
534,Mosquito,Co,555.65,2.221,2017,y,y,y,y,n,y,y,2,0,0,0,70,0.425,0.292,0.520833333,4.291666667,14.2875,0.067204288,9,0.25,0.478,0.375,0.6806,289.4,236.15,RACA,0,2,0.52 | |
537,Upper Boulder,Co,530.48,2.009,1927,y,y,y,y,n,y,y,3,5,0,0,240,1.17,0.875,0.46,5.125,14.11666667,0.068711911,8.3,0.04,0,0.875,0.9306,244.02,620.66,FI |
OlderNewer