Skip to content

Instantly share code, notes, and snippets.

@rpietro
rpietro / init.vim
Created December 31, 2019 21:51 — forked from danmikita/init.vim
File preview with FZF, RG, Bat, and Devicons
nnoremap <silent> <leader>e :call Fzf_dev()<CR>
" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
endif
" Files + devicons
@rpietro
rpietro / Submitting Rmd to Arxiv.md
Created October 22, 2019 14:59 — forked from JJ/Submitting Rmd to Arxiv.md
Submitting RMarkdown articles to Arxiv

Mini-HowTo submit RMarkdown articles to ArXiV

ArXiV is a place for publishing scientific technical reports and drafts which is tightly tied to LaTeX. That is why if you generate a PDF from your RMarkdown article it will tell you, hey, this has been generated using LaTeX, I want the LaTeX source. In principle, RStudio does not admit LaTeX as a final format, only .doc, .pdf or HTML. But it is no big deal.

You only need to add this to the metadata in the RMarkdown document

output: 
  pdf_document:
    keep_tex: true
# Tab completion
a<Tab> # first car and hit tab
# Instropection
a = 'Foo says hello'
a? # shows info about variable, docstrings if it is function/instance method
aa?? # shows source code
# Unix Commands
!git # normal git command inside Ipython. Most of the Unix commands can be used this way
require.install <- function(pkg, github=""){
req <- suppressWarnings(
suppressMessages(
require(package=paste(pkg), character.only=TRUE)
)
);
#print(github);
if(!req){
installOk <- FALSE;
if(length(github)<=0){

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods

Slimdown

A very basic regex-based Markdown parser. Supports the following elements (and can be extended via Slimdown::add_rule()):

  • Headers
  • Links
  • Bold
  • Emphasis
  • Deletions
@rpietro
rpietro / webScrape.r
Last active December 10, 2015 02:58 — forked from zachmayer/WebScrape.R
rm(list = ls(all = TRUE)) #CLEAR WORKSPACE
library(quantmod)
#Scrape data from the website
library(XML)
rawPMI <- readHTMLTable('http://www.ism.ws/ISMReport/content.cfm?ItemNumber=10752')
rawPMI
PMI <- data.frame(rawPMI[[1]])
PMI
names(PMI)[1] <- 'Year'
#assume you have a data set represented by an object called BOD (BOD is actually a dataset internal to R). then run dput with that data object
dput(BOD)
#the ouput of this function will be the representation of that data set: structure(list(Time = c(1, 2, 3, 4, 5, 7), demand = c(8.3, 10.3, 19, 16, 15.6, 19.8)), .Names = c("Time", "demand"), row.names = c(NA, -6L), class = "data.frame", reference = "A1.4, p. 270")
#when you want to request help, just start the reproducible example by throwing the output of dput into a data object:
BOD <- structure(list(Time = c(1, 2, 3, 4, 5, 7), demand = c(8.3, 10.3, 19, 16, 15.6, 19.8)), .Names = c("Time", "demand"), row.names = c(NA, -6L), class = "data.frame", reference = "A1.4, p. 270")
#from here on then just write the code you wrote and the corresponding error message