Skip to content

Instantly share code, notes, and snippets.

@corburn
corburn / Makefile
Last active December 29, 2015 07:19
Matrix vector multplication example from OpenCL In Action
PROJ=matvec
CC=gcc
CFLAGS=-std=c99 -Wall -DUNIX -g -DDEBUG
# Check for 32-bit vs 64-bit
PROC_TYPE = $(strip $(shell uname -m | grep 64))
# Check for Mac OS
@corburn
corburn / Makefile
Created December 7, 2013 16:03
Makefile with Auto-Dependency Generation
NAMES=main newClass newClass1
test: $(addsuffix .o, $(NAMES))
$(CXX) -o $@ $^
%.o: %.cpp
$(COMPILE.cc) -MMD -MP -o $@ $<
.PHONY: clean
clean:
@corburn
corburn / index.html
Last active February 25, 2024 16:25
Minimal HTML5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
@corburn
corburn / bithack.txt
Created January 10, 2014 19:36
MIT 6.172 Performance Engineering of Software Systems Open Courseware Lecture 2
// Swap two integers x and y without a temporary
// Performance poor with instruction-level parallelism (ILP)
// Each step has to wait for the previous step to compute before it can execute
x = x ^ y
y = x ^ y
x = x ^ y
// Minimum of two integers x and y without a branch.
// Can execute in about 4 cycles. Without a branch, the CPU doesn't have to clear
// the pipeline if it predicts the wrong branch.
@corburn
corburn / package.json
Last active August 29, 2015 14:00
A script to monitor umple files, generate Java with the umple tool, compile with javac, and run the program.
{
"name": "umplemon",
"version": "0.0.0",
"description": "Monitor, compile, and run Java umple files",
"main": "watch.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jason Travis",
"license": "GPLv3",
@corburn
corburn / print_types.py
Created May 17, 2014 19:43
Recursively pretty print types of complex python structure
def print_type(data, indent_level):
if type(data) == dict:
for key in data:
print '\t' * indent_level + str(key) + ' ' + str(type(data[key]))
print_types(data[key], indent_level+1)
elif type(data) == list:
for i in range(len(data)):
print '\t' * indent_level + str(i) + ' ' + str(type(data[i]))
print_types(data[i], indent_level+1)
@corburn
corburn / m2p.go
Last active August 29, 2015 14:01
Script to add a command to the Windows right-click context menu for text files
// Copyright Jason Travis
package main
import (
"encoding/csv"
"errors"
"fmt"
"io"
"log"
"os"
@corburn
corburn / eventPage.js
Created May 29, 2014 22:00
Use AngularJS module in Chrome Extension eventPage
// The first array is an array of angular modules. The ng module is optional.
// It is normally implicitly included and provides access to the angular API.
// The second array is the module components that will be injected as parameters
// to the final element which is a function.
angular.injector(['ng', 'myModule']).inject(['myModuleFactory', ..., eventCtrl]);
// This is where the event handlers are registered
function eventCtrl(myModuleFactory) {
chrome.tabs.onCreated.addListener(myModuleFactory.doStuff);
// ...
@corburn
corburn / .gitignore
Last active August 29, 2015 14:02
PHP PSR-4 Package
vendor/
composer.lock
@corburn
corburn / Requirements.md
Last active October 13, 2016 19:02
Requirements Document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

SHALL follow the semantic versioning rules as layed out in the Semantic Versioning Specification version 2.0.0 SEMVER.