Skip to content

Instantly share code, notes, and snippets.

View LeeMendelowitz's full-sized avatar

Lee Mendelowitz LeeMendelowitz

View GitHub Profile
@LeeMendelowitz
LeeMendelowitz / README.md
Last active August 29, 2015 14:16
Take a snapshot of a page with phantom JS

To run, download PhantomJS

From the terminal:

phantomjs snapshot.js > output.html
@LeeMendelowitz
LeeMendelowitz / Knitr_Latex_Template
Created February 25, 2015 19:42
Knitr Latex Template
\documentclass[12pt]{article}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[top=1in, bottom=1in, left=1.5in, right = 1.5in, marginparwidth=0.0in, marginparsep=0.25in]{geometry}
% \geometry{verbose,tmargin=0.75in,bmargin=0.75in,lmargin=0.75in,rmargin=0.75in} %Commented out in favor of the marginnote settings
\setcounter{secnumdepth}{2}
@LeeMendelowitz
LeeMendelowitz / bash.md
Last active August 29, 2015 14:16
Bash one-liners

find with redirected stdout

find . -name '*.aln' | xargs -I {} sh -c 'cut -f 1 "$1" > "$1.cut"' -- {}

This will find all files *.aln and then output the first column to *.aln.cut.

get filetypes

@LeeMendelowitz
LeeMendelowitz / time_call.R
Created March 7, 2015 18:14
Time R Function Calls
############################################################
# Time a call. Execution time is printed. Return the value of wrapped call
time.call <- function(expr) {
start.time <- proc.time()
ret = evalq(expr)
end.time <- proc.time()
print(end.time - start.time)
ret
@LeeMendelowitz
LeeMendelowitz / README
Last active August 29, 2015 14:18
Airport Survey
The Washington Post Aiport Survey
http://www.washingtonpost.com/express/wp/2015/03/31/national-reagan-dca-17-years-later-locals-still-cant-agree-on-the-name-of-the-airport-in-question/?wprss=rss_traffic
@LeeMendelowitz
LeeMendelowitz / excel_macro
Created April 8, 2016 17:32
Excel Macro for exporting all sheets as csv
Sub ExportSheetsToCSV()
Dim xWs As Worksheet
Dim xcsvFile As String
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.Copy
xcsvFile = xWs.Name & ".csv"
Application.ActiveWorkbook.SaveAs Filename:=xcsvFile, _
FileFormat:=xlCSV, CreateBackup:=False
Application.ActiveWorkbook.Saved = True
Application.ActiveWorkbook.Close