Skip to content

Instantly share code, notes, and snippets.

View alexpawlowski's full-sized avatar

Alex Pawlowski alexpawlowski

View GitHub Profile
@alexpawlowski
alexpawlowski / python_wsl.md
Last active May 17, 2020 21:08
Getting setup with python on windows

Getting setup with python on Windows

While Anaconda has made it much simpler to get python running on Windows, I think Windows Sublayer for Linux is a really good platform to do coding, especially if you later merge the code you're working on to a container online. Conda (Anaconda's product) is a package manager that takes care of most of the weird things you may encounter programming with windows when you're interfacing with Unix users. Python's built-ins like pathlib do even better.

  1. Enable WSL for Windows. Follow the instructions.
  • 1a. WSL2 is a different way that Windows runs Linux. It's defintely performs better, but requires a version of Windows 10 that's not available on stable release until late May 2020. If you don't mind updating to the required version, it's worth the hassle. Here are the [instructions](https://docs.mic
@alexpawlowski
alexpawlowski / when_your_antivirus_stops_your_R_package_installs.Rmd
Created December 7, 2017 18:05
Command to make your antivirus happy when installing new R packages
Typically this happens when you're on a work machine with McAfee with zero power to 'disable it'. The issue of course, is when you update your `R` packages, McAfee (and probably others) lock the temporary file that R uses in unzipping the downloaded folder of the package you are installing.
The first method is to just keep trying the install command (I find this handy for large lists of packages, like when you update `tidyverse`) some packages will fail to be moved, but some will get through!
When you get down to `Rcpp` and the last stragglers, you'll need to slow your roll, son.
To do so, use this command: [Source](http://r.789695.n4.nabble.com/unable-to-move-temporary-installation-td4521714.html#a4529846)
```R
debug(utils:::unpackPkgZip)
```
@alexpawlowski
alexpawlowski / jupyterlab_w_mpl.md
Created November 14, 2017 16:10
Helpful tip on getting jupyter lab up and running with matplotlib
LastUpdated versions
2017-11-14
python
3.6.3
jupyter
1.0.0
ipympl
0.0.12
ipywidgets
7.0.0
platform
win64_10

While Jupyter Lab is still in alpha and subject to change often (beta coming soon), it's interface is incredibly useful over the standard notebook interface.

Keybase proof

I hereby claim:

  • I am alexpawlowski on github.
  • I am alexpawlowski (https://keybase.io/alexpawlowski) on keybase.
  • I have a public key whose fingerprint is 29E4 84AB 9DDD 0286 933D 542C 72EB 4CC2 2DD8 5222

To claim this, I am signing this object:

@alexpawlowski
alexpawlowski / PRESS.R
Last active August 29, 2015 14:12 — forked from tomhopper/PRESS.R
#' @title PRESS
#' @author Thomas Hopper
#' @description Returns the PRESS statistic (predictive residual sum of squares).
#' Useful for evaluating predictive power of regression models.
#' @param linear.model A linear regression model (class 'lm'). Required.
#'
PRESS <- function(linear.model) {
#' calculate the predictive residuals
pr <- residuals(linear.model)/(1-lm.influence(linear.model)$hat)
#' calculate the PRESS