Skip to content

Instantly share code, notes, and snippets.

View asauber's full-sized avatar

Andrew Sauber asauber

View GitHub Profile
@asauber
asauber / randline.py
Last active August 29, 2015 14:07
Read a random line from a file, supporting stdin
#!/usr/bin/env python
import random
import sys
def random_line(file_handle):
lines = file_handle.readlines()
num_lines = len(lines)
random_line = None
@asauber
asauber / nslds_login_fix.js
Created September 11, 2014 18:28
"nsdls pin doesn't work" A fix for the broken log-in page on nslds.ed.gov
var pinPads = document.querySelectorAll('.bloc select');
for (var i = 0, len = pinPads.length; i < len; ++i) {
pinPads[i].style.margin = "0";
}
/**
* Bead Ornaments - HackerRank Spring 2013 Hackathon
* Java bitmask DP solution
* Author: Jerry Ma (2013)
*
* Note that this solution uses BigInteger, which in some cases can add an unacceptable amount of overhead.
* This solution uses recursion with memoization to store the results for previously calculated states.
*/
import java.math.*;
@asauber
asauber / ctags_with_deps.sh
Last active August 29, 2015 14:03
Script to generate ctags including dependencies
#!/bin/bash
# Usage: $ ./ctags_with_deps.sh *
CC="gcc"
CFLAGS=""
CTAGSFLAGS=""
# Use the .ctagshelp file as a configuration file for your compiler and ctags
#
This file has been truncated, but you can view the full file.
admins-macbook:~ admin$ HOMEBREW_MAKE_JOBS=1 brew install -v gcc49 --disable-multilib 2>&1
==> Downloading ftp://gcc.gnu.org/pub/gcc/snapshots/4.9-20140302/gcc-4.9-20140302.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc49-4.9-20140302.tar.bz2
==> Verifying gcc49-4.9-20140302.tar.bz2 checksum
tar xf /Library/Caches/Homebrew/gcc49-4.9-20140302.tar.bz2
==> ../configure --build=i686-apple-darwin10.8.0 --prefix=/usr/local/Cellar/gcc49/4.9-20140302 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --disable-multilib
checking build system type... i686-apple-darwin10.8.0
checking host system type... i686-apple-darwin10.8.0
checking target
This file has been truncated, but you can view the full file.
admins-macbook:~ admin$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 34b863f902f471019e4f658c8bf39dc7e234fd14
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 32-bit core
OS X: 10.6.8-i386
Xcode: 3.2.6
GCC-4.0: build 5494