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
| # Setup | |
| # Make selenium and chromedriver work for Untappd.com | |
| from selenium import webdriver | |
| from selenium.webdriver.chrome.options import Options | |
| from webdriver_manager.chrome import ChromeDriverManager | |
| #driver = webdriver.Chrome() | |
| driver = webdriver.Chrome(ChromeDriverManager().install()) |
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
| while read p; do git clone https://github.com/$p ${p%/*}; done <files.txt |
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
| for FILE in *.zip; do unzip -j -d ${FILE%.*} $FILE; done | |
| # for rar, first install it via `brew install rar` & provide permissions for app to launch (e.g., on Mac) | |
| for FILE in *.rar; do unrar X $FILE -op${FILE%.*} -ep; 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
| # From a variance-covariance matrix to a cholesky decomposition (and back) | |
| ## Let's first define our var-covar matrix | |
| varcovar = diag(3) | |
| varcovar[1,2] <- .5 | |
| varcovar[2,1] <- .5 | |
| ## Let's get our (upper) cholesky decomposition | |
| decomp = chol(varcovar) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| dir.create('../gen/test', recursive = T) | |
| sink('../gen/test/test.txt') | |
| cat('This is test 1') | |
| sink() | |
| dir.create('../gen/test2', recursive = T) | |
| sink('../gen/test2/test2.txt') | |
| cat('This is test 2') |
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
| # Cleanup, wiping the (sub)directories output/temp/audit | |
| wipe: | |
| R -e "unlink('../../gen/data-preparation/output/*.*')" | |
| R -e "unlink('../../gen/data-preparation/temp/*.*')" | |
| R -e "unlink('../../gen/data-preparation/audit/*.*')" | |
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
| # Looping | |
| for (i in 1:10) { | |
| print(i) | |
| } | |
| # Using looping with return values (i.e., to "save" stuff to carry on working) | |
| results = lapply(1:10, function(x) x*2) | |
| # Demo to download all of Europe's listing data to R | |
| library(googledrive) |