Skip to content

Instantly share code, notes, and snippets.

@sehe
sehe / Makefile
Last active July 28, 2023 11:26
Simplifying sequential use of Asio operations with timeouts
all:TCPClient
CPPFLAGS+=-std=c++11 -Wall -pedantic -g -O2 -pthread
%.o: TCPClient.hpp
%: %.o
$(CXX) $(CPPFLAGS) $^ -o $@ -lboost_system
@sehe
sehe / Makefile
Last active January 16, 2023 08:29
Boost shared memory lockfree circular buffer queue
all:consumer producer
CPPFLAGS+=-std=c++03 -Wall -pedantic
CPPFLAGS+=-g -O0
CPPFLAGS+=-isystem ~/custom/boost/
LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib
LDFLAGS+=-lboost_system -lrt -lpthread
%:%.cpp
@sehe
sehe / test.cpp
Created August 26, 2022 16:21
tweaking a simple Asio channel benchmark
//#define TWEAKS
#ifdef TWEAKS
#define BOOST_ASIO_DISABLE_THREADS 1
#endif
#include <boost/asio.hpp>
#include <boost/asio/experimental/awaitable_operators.hpp>
#include <boost/asio/experimental/channel.hpp>
@sehe
sehe / .gitignore
Last active July 8, 2020 11:07
converting regular expressions to dot graphs (with boost spirit)
*.o
a.out
test
.*.swp
*~
*.png
tags
@sehe
sehe / Makefile
Last active April 17, 2020 21:41
C++ version of reverse-complement
all: cpp-version c-version alioth
CPPFLAGS+=-g -O3
CPPFLAGS+=-march=native
# LDFLAGS+=-ltcmalloc
CXXFLAGS+=$(CPPFLAGS) -std=c++0x
LDFLAGS+=-lpthread
# CXX=clang++
/* 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 / companylist.csv
Last active January 28, 2019 09:01
Perfect hash demo for 100 ticker symbols
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
"Symbol","Name","LastSale","MarketCap","ADR TSO","IPOyear","Sector","industry","Summary Quote",
"FLWS","1-800 FLOWERS.COM, Inc.","5.35","346341419.9","n/a","1999","Consumer Services","Other Specialty Stores","http://www.nasdaq.com/symbol/flws",
"FCTY","1st Century Bancshares, Inc","5.66","51712720.18","n/a","n/a","Finance","Major Banks","http://www.nasdaq.com/symbol/fcty",
"FCCY","1st Constitution Bancorp (NJ)","8.75","52433482.5","n/a","n/a","Finance","Savings Institutions","http://www.nasdaq.com/symbol/fccy",
"SRCE","1st Source Corporation","23.41","592166437.68","n/a","n/a","Finance","Major Banks","http://www.nasdaq.com/symbol/srce",
"FUBC","1st United Bancorp, Inc. (FL)","6.28","215322711.68","n/a","n/a","Finance","Major Banks","http://www.nasdaq.com/symbol/fubc",
"VNET","21Vianet Group, Inc.","8.65","499393330.45","n/a","n/a","Technology","Computer Software: Programming, Data Processing","http://www.nasdaq.com/symbol/vnet",
"SSRX","3SBio Inc.","15.19","335433068.67","n/a","2007","Consumer Durables
# This makefile was handwritten by Seth Heeren
# Replicates 90% of http://www.multi.fi/~ghaga/mymakefile/
######################################
TARGET_NAME=mymakemaker
## Targets
##########
all: exe dynamic static objs
clean:
//////////////////////////////////////////////////////////////////////////////
// 'mymakefile' is a tool for creating makefiles to be used with make
//
// Author: Greg Haga 2018
// email: ggh@multi.fi
//
// Quick reimplementation in C++ by Seth Heeren, public domain
///////////////////////////////////////////////////////////////////////////////
#include <unistd.h> // chdir
#include <experimental/filesystem>
//#define BOOST_SPIRIT_DEBUG
#include <boost/fusion/adapted/struct.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <iomanip>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/container/flat_set.hpp>
#include <fstream>