Skip to content

Instantly share code, notes, and snippets.

View justbuchanan's full-sized avatar

Justin Buchanan justbuchanan

View GitHub Profile
@justbuchanan
justbuchanan / BasicGraphSearchTests.java
Last active August 29, 2015 13:58
CS 1332 HW9 Tests
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import static org.junit.Assert.assertTrue;
@justbuchanan
justbuchanan / UIKit Delegate Behavior Demo
Last active December 21, 2015 00:58
Demo of the UIKit delegate behavior described in this pull request: https://github.com/ReactiveCocoa/ReactiveCocoa/pull/745
@interface Delegate : NSObject <UIActionSheetDelegate>
@end
@implementation Delegate
- (BOOL)respondsToSelector:(SEL)aSelector {
NSLog(@"-respondsToSelector: '%@'", NSStringFromSelector(aSelector));
return YES;
}
@end
@justbuchanan
justbuchanan / Graphviz Makefile
Created September 9, 2013 03:00
Simple makefile to generate images from all *.dot files in the directory.
TYPE=png
SRC=$(wildcard *.dot)
OUT=$(patsubst %.dot, %.$(TYPE), $(SRC))
all: $(OUT)
%.$(TYPE): %.dot
dot -T$(TYPE) $^ -o $@
# Uncrustify 0.60
newlines = auto
input_tab_size = 4
output_tab_size = 4
string_escape_char = 92
string_escape_char2 = 0
tok_split_gte = false
utf8_bom = ignore
utf8_byte = false
utf8_force = false
@justbuchanan
justbuchanan / cs1332.txt
Last active January 3, 2016 08:59
This used to contain a makefile for use with CS 1332 @ GT. It has been moved to its own repo, please see below:
This has been moved from a gist to its own repo. Check it out at:
http://github.com/justbuchanan/cs1332-hw-template
@justbuchanan
justbuchanan / main.cpp
Last active February 17, 2016 20:49
Stream-based logging test
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class LogHelper : public stringstream {
public:
LogHelper(string level) {
@justbuchanan
justbuchanan / to_binary.hpp
Created February 25, 2016 17:28
Get the binary representation of integral types in C++ as strings
#include <string>
template<typename TYPE, char BYTE_SEPARATOR = ' '>
std::string toBinary(TYPE val) {
std::string str("b");
for (int i = sizeof(TYPE)*8-1; i >= 0; i--) {
str += ((val & 1 << i) ? "1" : "0");
if (i % 8 == 0 && i !=0 ) str += BYTE_SEPARATOR;
}
return str;
/*
This is a simple program for the MBED intended to determine what happens if a signal for a thread is
set before the corresponding wait is called. It behaves as expected, so the bug I'm tracking down is somewhere else...
*/
#include <mbed.h>
#include <rtos.h>
#include <cmsis_os.h>
void thread(const void* arg) {
@justbuchanan
justbuchanan / keybase.md
Created May 22, 2016 01:31
Keybase GitHub proof

Keybase proof

I hereby claim:

  • I am justbuchanan on github.
  • I am justbuchanan (https://keybase.io/justbuchanan) on keybase.
  • I have a public key ASD1L3Wi4J_PeKhF5_YV_X1V1B9Em2Sepm6HRtob8TqFRwo

To claim this, I am signing this object:

#!/usr/bin/env python2
#
# This script builds a ball-placement SSL Referee message for the yellow team
# and repeatedly broadcasts it. Usage:
# ./send_ssl_placement_cmd.py <x coord> <y coord>
#
# Install protobuf:
# pip2 install protobuf
#
# Compile protobuf files (this creates referee_pb2.py):