Skip to content

Instantly share code, notes, and snippets.

View mikealexander's full-sized avatar
💻

Mike Alexander mikealexander

💻
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mikealexander on github.
  • I am hcfmike (https://keybase.io/hcfmike) on keybase.
  • I have a public key ASBc-YBD50Z_i8gZuigt5soeKGjt1TZivu9eAk3NIhrWKAo

To claim this, I am signing this object:

Macro.InsertText(".ForMember(dest => dest.Id, opts => opts.Ignore()");
dte.ActiveDocument.Selection.WordLeft(false, 8);
dte.ActiveDocument.Selection.WordLeft(true);
@mikealexander
mikealexander / UserStories.js
Last active August 29, 2015 14:14
Node script for generating boring user stories for ExamCloud
var fs = require('fs');
fs.writeFile('output.txt', '', function(){ });
var write = function(o) {
fs.appendFile('output.txt', (o + '\n'), function (err) {
if (err) {
log.info("Problem appending to file.");
}
});
}
@mikealexander
mikealexander / calculate_bounds.cpp
Created April 2, 2014 00:54
Figures out starting and ending positions for each CUDA thread in each block for use by a parallel sequential searching algorithm.
#include <string>
#include <string.h>
int **starts, **ends;
const int NUM_BLOCKS = 9, THREADS_PER_BLOCK = 10;
const std::string input = "assign4input1";
// figures out the start and end position for every thread and puts them in 2D arrays.
void calculateStarts(int textLength, int patternLength)
{
int hostMatch(long *comparisons, int numthreads) {
int pos, i, j, lastI;
long comps = 0;
pos = -1;
lastI = textLength-patternLength;
#pragma omp parallel private(i, j) shared(pos) num_threads(numthreads) reduction(+ : comps)
#pragma omp for schedule(static)
for(i=0; i <= lastI; i++) {
if (pos == -1) {
int hostMatch(long *comparisons, int numthreads) {
int pos, i, j, lastI;
long comps = 0;
pos = -1;
lastI = textLength-patternLength;
#pragma omp parallel private(i, j) shared(pos) num_threads(numthreads) reduction(+ : comps)
#pragma omp for schedule(static)
for(i=0; i <= lastI; i++) {
@mikealexander
mikealexander / searching_OMP_0.c
Last active August 29, 2015 13:57
Works now :)
int hostMatch(long *comparisons, int numthreads) {
int pos, i, j, lastI;
long comps = 0;
pos = -1;
lastI = textLength-patternLength;
#pragma omp parallel private(i, j) shared(pos) num_threads(numthreads) reduction(+ : comps)
#pragma omp for schedule(static)
for(i=0; i <= lastI; i++) {
j=0;
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
char * generatePattern(int size) {
int i;
// allocate enough memory for array of size+1 characters (the extra is for null termination)