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
#From http://stackoverflow.com/questions/11025123/how-to-convert-r-markdown-to-pdf | |
rmd2pdf.bash: | |
RMDFILE=`echo ${1%%.*}` | |
echo "PROCESSING $RMDFILE" | |
Rscript -e "require(knitr); require(markdown); knit('$RMDFILE.rmd', '$RMDFILE.md'); markdownToHTML('$RMDFILE.md', '$RMDFILE.html', options=c('use_xhml'))" | |
pandoc -s "$RMDFILE.html" -o "$RMDFILE.pdf" | |
for f in *Rmd;do ./rmd2pdf.bash $f;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
import PyICU | |
# below from http://stackoverflow.com/questions/13838405/custom-sorting-in-pandas-dataframe | |
df = token_count | |
locale = 'UR.UTF-8' | |
collator = icu.Collator.createInstance(icu.Locale(locale)) | |
def sort_pd(key=None,reverse=False,cmp=None): | |
def sorter(series): |
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
df | |
xdf = df[df.index.isin(adf.index.append([bdf.index, cdf.index]))] |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
background: #fcfcfa; | |
} | |
.stroke { | |
fill: none; |
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
/* | |
Copyright (c) 2019, Michigan State University | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the |
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
from hashlib import md5 | |
def google_md5sum(filen): | |
"""Return Google Drive /Cloud Storage hexadecimal equivalent md5sum. | |
Updates md5 hashalg by reading 8k chunks. Adapted from gsutil.""" | |
hashalg = md5() | |
with open(filen, "rb") as f: | |
f.seek(0) | |
while True: |