Skip to content

Instantly share code, notes, and snippets.

View asauber's full-sized avatar

Andrew Sauber asauber

View GitHub Profile
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
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
@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
#
/**
* 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 / 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";
}
@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 / download_floss_weekly.sh
Created December 10, 2014 15:26
Download all FLOSS Weekly episodes, in reverse order, skipping those that are already downloaded
#!/bin/bash
wget_floss_n () {
floss_number=$(printf "%04d\n" $1)
wget -nc http://www.podtrac.com/pts/redirect.mp3/twit.cachefly.net/audio/floss/floss$floss_number/floss$floss_number.mp3
}
latest_show=$(wget http://twit.tv/show/floss-weekly -O - | grep "show-title" | egrep -o "\d+" | sort -ru | head -n 1)
for n in $(seq $latest_show -1 1)
@asauber
asauber / Makefile
Last active August 29, 2015 14:11
World Wide Daemon
CC = gcc
CFLAGS = -Wall -O3 --std=c11
CDEBUGFLAGS = -Wall -O0 --std=c11 -g
wwd: main.c
$(CC) $(CFLAGS) -o $@ $<
@asauber
asauber / subsetsum.py
Created December 28, 2014 05:59
Dynamic Programming Example
'''
How many ways can the set of numbers from 1 to N be partitioned into two
subsets in such a way that the sum of both subsets is equal?
Hint 1. For each partitioning, the sum of each subset will be the same value
Hint 2. This value is the sum from 1 to N divided by 2. (N * (N + 1) / 2) / 2
Hint 3. The problem has been reduced to, "How many subsets of a given set sum
to a specific value?". Note that once we have this number of subsets, we
@asauber
asauber / subsetsum.cpp
Last active August 29, 2015 14:12
Dynamic Programming Example (C++)
/*
How many ways can the set of numbers from 1 to N be partitioned into two
subsets in such a way that the sum of both subsets is equal?
Hint 1. For each partitioning, the sum of each subset will be the same value
Hint 2. This value is the sum from 1 to N divided by 2. (N * (N + 1) / 2) / 2
Hint 3. The problem has been reduced to, "How many subsets of a given set sum
to a specific value?". Note that once we have this number of subsets, we