Skip to content

Instantly share code, notes, and snippets.

View bholt's full-sized avatar

Brandon Holt bholt

View GitHub Profile
@bholt
bholt / .gitconfig
Last active August 29, 2015 14:00
Git Config Snippet
[color]
# color whenever it's going to a terminal
ui = auto
[core]
# global excludes go here
excludesfile = ~/.gitignore_global
ignorecase = false
autocrlf = input
@bholt
bholt / .Rprofile
Created April 29, 2014 01:59
R init
setwd(Sys.getenv("PWD"))
# Set hook to be run when Defaults is attached
setHook(packageEvent("Defaults", "attach"),
function(...) { setDefaults(q, save="yes"); useDefaults(q) })
# add Defaults to the default packages loaded on startup
old <- getOption("defaultPackages");
options(defaultPackages = c(old, "Defaults"))
options(repos=structure(c(CRAN="http://cran.fhcrc.org/")))
@bholt
bholt / mpihello.c
Created April 1, 2014 17:23
MPI Hello World
#include <mpi.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
MPI_Init(&argc, &argv);
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
@bholt
bholt / spawn.cpp
Created November 19, 2013 03:18
Experimenting with async/balancing syntax for task spawn, parallel loop, etc.
#include <accel-cpp/log.hpp>
#include <boost/variant.hpp>
#include <map>
#include <vector>
#include <sstream>
using namespace std;
enum SyncMode { async, blocking };
enum BalancingMode { none, balancing };
@bholt
bholt / glog.diff
Last active December 25, 2015 13:39
Patch for installing `google-glog` using Clang on OSX.
diff --git a/trunk/src/stl_logging_unittest.cc b/trunk/src/stl_logging_unittest.cc
--- a/trunk/src/stl_logging_unittest.cc (revision 137)
+++ b/trunk/src/stl_logging_unittest.cc (working copy)
@@ -31,17 +31,20 @@
#ifdef HAVE_USING_OPERATOR
-#ifdef __GNUC__
+#include <iostream>
+
#include <mpi.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
MPI_Init(&argc, &argv);
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSWorkspace</key>
<key>SystemConfiguration</key>
<dict>
<key>State:/Network/Global/IPv4</key>
<dict>
<key>command</key>
source ~/grappa/system/grappa_gdb.macros
# blue (gdb) prompt
set prompt \033[0;34m(gdb)\033[0m
shell mkfifo /tmp/bholt_gdb_color_pipe
define hook-backtrace
shell cat /tmp/bholt_gdb_color_pipe | sed -e 's/\(^#[0-9]*.*in \|^#[0-9]*\) \(.*\) \((.*)\)/\1 '$(echo -e '\033[0;33m')'\2 '$(echo -e '\033[0;36m')'\3'$(echo -e '\033[0m')'/' | sed -e 's/\/sampa\/home\/bholt\(\/.*:[0-9]*\)/'$(echo -e '\033[0;32m')'~\1'$(echo -e '\033[0m')'/' &
set logging redirect on
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@bholt
bholt / viz.rb
Created November 16, 2012 20:31
#!/usr/bin/env ruby
require "rubyvis"
vis = Rubyvis::Panel.new do
width 150
height 150
bar do
data [1, 1.2, 1.7, 1.5, 0.7, 0.3]
width 20
height {|d| d * 80}