Skip to content

Instantly share code, notes, and snippets.

View kylebarron's full-sized avatar

Kyle Barron kylebarron

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kylebarron on github.
  • I am kylebarron (https://keybase.io/kylebarron) on keybase.
  • I have a public key whose fingerprint is 8AE7 20E6 5E4A BE32 7004 32BD 4E42 1C70 00D0 AAB2

To claim this, I am signing this object:

@kylebarron
kylebarron / teach-yourself-cs-setup.sh
Created February 22, 2018 03:52
Set up folder and download materials for teachyourselfcs.com
#! /usr/bin/env bash
mkdir teach-yourself-cs
cd teach-yourself-cs
# Create directory structure
mkdir 1_programming
mkdir 2_computer-architecture
mkdir 3_algorithms-and-data
mkdir 4_math-for-cs
@kylebarron
kylebarron / myjobs.sh
Last active May 1, 2018 17:45
List jobs using >= 1GB of memory on remote servers
#! /usr/bin/env bash
# This depends on `smem`, a memory reporting tool, being available on the remote server
# The following two commands will put the smem executable in your current directory
# wget https://selenic.com/repo/smem/archive/tip.tar.gz
# tar -xzvf tip.tar.gz --wildcards "smem-*/smem" --strip-components 1
#
# You then need to change `smem_path` to the path on the remote server of smem
smem_path="/disk/homedirs/barronk-dua51929/local/bin/smem"
@kylebarron
kylebarron / stata_desc.py
Created May 11, 2018 18:16
Create Markdown file with description of Stata dta file
#! /usr/bin/env python3
"""
---------------------------------------------------------------------
Program: stata_desc.py
Author: Kyle Barron <barronk@mit.edu>
Created: 5/11/2018, 2:01:13 PM
Purpose: Generate markdown data codebooks for documentation
The command line input should be the path to the `.dta` file.
@kylebarron
kylebarron / pandoc-svg.py
Last active June 6, 2018 18:00 — forked from jeromerobert/pandoc-svg.py
Pandoc filter to create PDF files from SVG
#! /usr/bin/env python
"""
Pandoc filter to convert svg files to pdf as suggested at:
https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
rsvg-convert or inkscape must be installed
"""
__author__ = "Jerome Robert"
@kylebarron
kylebarron / whitney_scrape.py
Last active June 22, 2018 15:05
Scrape Mt. Whitney permits and email me if one is available
#! /usr/bin/env python3
"""
---------------------------------------------------------------------
Program: recreation_gov_scrape.py
Author: Kyle Barron <barronk@mit.edu>
Created: 6/15/2018, 9:38:50 PM
Updated: 6/15/2018, 9:38:50 PM
Purpose: Scrape Mt. Whitney permits and email me if one is available
"""
@kylebarron
kylebarron / statab
Last active June 28, 2018 19:28 — forked from pschumm/statab
Wrapper for "stata -b" which issues an informative error msg and appropriate (i.e., non-zero) return code
#! /usr/bin/env bash
# Wrapper for "stata -b" which issues an informative error msg and appropriate
# (i.e., non-zero) return code
# The basic idea for this script (including grepping the log file to determine
# whether there was an error) was taken from a similar script posted by Brendan
# Halpin on his blog at http://teaching.sociology.ul.ie/bhalpin/wordpress/?p=122
# This script was forked from https://gist.github.com/pschumm/b967dfc7f723507ac4be
@kylebarron
kylebarron / check_stata_log.sh
Created July 24, 2018 23:42
Check Stata log for errors and issue a non-zero return code if an error occurred.
#! /usr/bin/env bash
# Check Stata log for errors and issue a non-zero return code if an error
# occurred.
#
# The idea for this came from
# https://gist.github.com/pschumm/b967dfc7f723507ac4be
# Accepts either:
# a single argument, the log file
# the log file piped to stdin
@kylebarron
kylebarron / bigmem.py
Last active July 30, 2018 20:39
Email user with notification if he/she is using all memory on a node
#! /usr/bin/env python3
"""
---------------------------------------------------------------------
Program: bigmem.py
Author: Kyle Barron <barronk@mit.edu>
Created: 3/21/2018, 11:56:17 AM
Updated: 3/21/2018, 11:56:20 AM
Purpose: Email user with notification if he/she is using all memory on a node
"""
@kylebarron
kylebarron / showload.sh
Last active August 6, 2018 15:46
showload on NBER server from local computer
#! /usr/bin/env bash
ssh barronk@age4.nber.org \
-o LogLevel=QUIET \
-t $'showload | sed -n \'/-----/,$p\' | sed -r \'/afserver|gruber|miller|sas|age8|age11|age12/d\' | sed -e \'/It might/,$d\''