Skip to content

Instantly share code, notes, and snippets.

View ashander's full-sized avatar

Jaime Ashander ashander

View GitHub Profile
@ashander
ashander / keybase.md
Created September 15, 2016 02:38
keybase verification

Keybase proof

I hereby claim:

  • I am ashander on github.
  • I am ashander (https://keybase.io/ashander) on keybase.
  • I have a public key ASB64liKYYs5Ynv_-hUY2oWx0u_J4KWK9CbksBDJliS7fgo

To claim this, I am signing this object:

@ashander
ashander / unfavorite.js
Last active November 1, 2024 20:25
Delete all your favorites (unfavorite or unlike every tweet) on twitter.com (thx to @JamieMason and @b44rd for inspiring this)
// 1. Go to https://twitter.com/i/likes
// 2. Keep scrolling to the bottom repeatedly until all your favs are loaded.
// 3. Run this in your console (open in chrome by View > Developer > JavaScript Console)
// Notes: this may take a while if you have a lot of favs/likes
// you can only access your most recent ~2000 likes.
// inspired by https://gist.github.com/JamieMason/7580315
$('.ProfileTweet-actionButtonUndo').click()
@ashander
ashander / method-dispatch.r
Last active May 12, 2016 17:25
Rephrased example from Advanced R of method dispatch (http://adv-r.had.co.nz/S3.html)
## example from http://adv-r.had.co.nz/S3.html
newmean <- function (x, ...) {
UseMethod("newmean", x)
}
newmean.numeric <- function(x, ...) sum(x) / length(x)
newmean.data.frame <- function(x, ...) sapply(x, mean, ...)
newmean.matrix <- function(x, ...) apply(x, 2, mean)
#numeric a
a <- c(1, 2, 6)
@ashander
ashander / use-overleaf-with-repo.md
Last active June 23, 2024 04:45
Using overleaf for realtime (ish) collaboration with an existing git repo

on overleaf.com

  • start a blank overleaf project
  • go to the share menu and copy git link from "Clone with git" (e.g. https://git.overleaf.com/blahblahblaah)

in your local repo

set up overleaf as a remote

git remote add overleaf https://git.overleaf.com/blahblahblaah
git checkout -b collaboration overleaf/master
@ashander
ashander / recover-iterm2-tmux.md
Last active May 5, 2016 19:57
recovering iTerm2 when a process inside a tmux-integrated session lock up and session restoration is enabled
  • kill iterm2 from Activity Monitor
  • open a terminal
  • login to tmux and back up using tmux resurrect or similar
pkill iTerm
ps |grep tmux
kill -9 # for each [pid] correesponding to a `tmux -CC` process, 
 # you could use pkill instead if you got the pattern right?
@ashander
ashander / bin-stuff.r
Created April 15, 2016 22:33
R file for binning stuff. GPL 3.
# placeholder
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ashander
ashander / get_spdf_gadm.R
Last active August 29, 2015 14:16
Looking at mapping from gadm using gadm2 urls
## urls were updated for gdam2 -- should go to gadm.org to update for each run of this
## http://gadm.org/country
## choose a country and R spdf from dropdown
## eg for
##for AFG sends POST req http://gadm.org/download?OK=OK&_submit_check=1&cnt=AFG_Afghanistan&thm=R%23R%20data
##returns page with list of download links (likely based on your location and data availability)
## part of the page looks like
##
## download
@ashander
ashander / extern-test.R
Last active August 29, 2015 14:07
minimal example for knitr externalization issue
## @knitr my-external-chunk
set.seed(111)
rnorm(100)
@ashander
ashander / ESAhtmltableexample.R
Created August 26, 2014 20:26
Grabbing data from html tables in ESA-archived data
# get data from html tables in ESA archive
# http://www.esapubs.org/archive/mono/M081/023/suppl-1.htm
library(XML)
root <- 'http://www.esapubs.org/archive/mono/M081/023'
tips <- c('limn.html', 'latitudes.html', 'fish.html', 'acronyms.html')
dat <- lapply(tips, function(t)
readHTMLTable(paste(root, t, sep='/')))