Skip to content

Instantly share code, notes, and snippets.

@sehe
sehe / submodule.sh
Created September 10, 2011 14:54
Git is_submodule function
#!/bin/bash
cat >> /dev/null <<"HERE"
Looking good. There is a bug in
for line in $submodules; do cd "$parent_git/$line"; \
if [[ `pwd` = $_git_dir ]]; then return 0; fi; \
done
because it won't cd back (so it would only work if the first submodule
digraph G {
graph [layout=dot/*circo*/ rankdir=TB];
edge[style=invisible,arrowhead=none];
{ rank=same; a->b->c->d; }
{ rank=same; e->f->g->h; }
{ rank=same; i->j->k->l; }
edge[style=solid,arrowhead=normal];
{ a; c; d } -> { e; f; } // [label="3"]
@sehe
sehe / Makefile
Created September 21, 2011 19:09
more utility code
all: new
CPPFLAGS+=--std=c++0x
CPPFLAGS+=-g -O3
CPPFLAGS+=-I ~/custom/boost_1_47_0/
new: new.hpp.gch
%.hpp.gch: %.hpp
g++ $(CPPFLAGS) $< -o $@
#include <boost/regex.hpp>
#include <boost/range.hpp>
#include <cstring>
#include <cstdio>
#include <chrono>
using namespace boost;
using namespace boost::range;
static std::string expand(const std::string& in)
/* Joe Pea - Assignment 5 */
// FILE: linked_list.h
// TEMPLATE CLASS PROVIDED:
// sequence<Item> (part of the namespace CISP430_A3)
// This is a container class for a sequence of items,
// where each List may have a designated item called the current item).
// The template parameter <value_type> is the data type of the items
// in the List. It may be any of the C++ built-in types (int, char, etc.),
// or a class with a default constructor, an assignment operator,
@sehe
sehe / linked_list.cpp
Created November 5, 2011 12:25
old fashioned, 'best practice' solution to duplicate linkage error
/* Joe Pea - CISP430 Assignment 5 */
#include "linked_list.h"
namespace CISP430_A5 {
string charList_join(const char* glue, linked_list<char> pieces) {
string joined = "";
all:test cppversion
%:%.c
gcc -O0 -g $^ -o $@ -lcurl
cppversion: test.cpp
g++ -O0 -g $^ -o $@ -lcurl
@sehe
sehe / Test.cpp
Created November 9, 2011 23:08
BaseMFCIter
#include < iterator >
#include "afxwin.h"
#include "afxtempl.h"
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
class myCObject : public CObject
{
all:test heuristic
CPPFLAGS+= -std=c++0x
CPPFLAGS+= -Wall -g
CPPFLAGS+= -march=native -mtune=native
CPPFLAGS+= -Ofast
#CPPFLAGS+= -Ofast -ffast-math #-ffast-fp
# CPPFLAGS+=-D_GLIBCXX_PARALLEL -fopenmp