Skip to content

Instantly share code, notes, and snippets.

View willkill07's full-sized avatar
🏠
Working from home

Will Killian willkill07

🏠
Working from home
View GitHub Profile
int main()
{
auto t = make_scoped(
task(
[] (auto x) {
}, token,
then(
[] (auto x) {
@willkill07
willkill07 / memtrace.cpp
Last active August 29, 2015 14:15
Memory Trace C++11
#include <array>
#include <functional>
#include <iostream>
#include <new>
#include <type_traits>
#include <vector>
#define M 2
#define N 4
#define P 2
@willkill07
willkill07 / stack.hpp
Created February 22, 2015 02:27
C++11 stack implemented with std::forward_list
#include <forward_list>
template <typename Type, typename Allocator = std::allocator <Type>, typename SizeType = std::size_t>
class
stack
{
public:
using value_type = Type;
using allocator_type = Allocator;
using reference = value_type &;
@willkill07
willkill07 / gist:377ea99ed01f44f0cb37
Created April 4, 2015 21:15
goto in bash (with reverse seeking)
#!/bin/bash
# include this boilerplate
function jumpto
{
label=$1
cmd=$(sed -n "/#$label:/{:a;n;p;ba};" $0)
eval "$cmd"
exit
}
start=${1:-"start"}
#include <iostream>
#include <array>
#include <algorithm>
#include <numeric>
typedef unsigned long long ULL;
// Delcare the litparser
template<ULL Sum, char... Chars> struct litparser;
#!/bin/bash
echo "Regenerating README Table"
if [ -a .commit ]
then
rm -f .commit
cat<<'EOF' > .process.awk
#!/usr/bin/env gawk
BEGIN{
FS = "[| \t]+";
@willkill07
willkill07 / iterDeductionSmokeTest.cpp
Created September 19, 2016 18:09
Here's a smoketest which compiles correctly with NVCC given all of the same compiler options as RAJA
/*
$ /opt/cuda/bin/nvcc --keep iterDeductionSmokeTest.cpp -m64 -DRAJA_ENABLE_NESTED -O2 -restrict -arch compute_35 -std c++11 --expt-extended-lambda -x cu -ccbin /opt/cuda/bin/g++ -Xcompiler -fopenmp -DNVCC -I/opt/cuda/include -I/opt/cuda/include -I/home/wkillian/RAJA_build/tpl/src/googletest/include -I/home/wkillian/RAJA_build/include/RAJA -I/home/wkillian/RAJA_build/include -I/home/wkillian/RAJA/include -I/home/wkillian/RAJA/test/include
*/
#include <iostream>
#include <iterator>
#include <type_traits>
#include <algorithm>
#include <RAJA/RAJA.hxx>
@willkill07
willkill07 / Day04.cpp
Created December 5, 2016 03:30
Day04 AoC 2016
#include <algorithm>
#include <iostream>
#include <vector>
#include <chrono>
int main() {
int index{-1};
int sum{0};
std::string line;
auto timeStart = std::chrono::high_resolution_clock::now();
@willkill07
willkill07 / day6.s
Created December 7, 2016 03:07
Day 6 x86-64 Assembly generated
.file "Day06.c"
.text
.p2align 4,,15
.globl file_size
.type file_size, @function
file_size:
.LFB4874:
.cfi_startproc
subq $152, %rsp
.cfi_def_cfa_offset 160
@willkill07
willkill07 / make_regex.cpp
Created December 7, 2016 21:21
regular expression generator from pattern (e.g. abba)
#include <iostream>
#include <map>
#include <sstream>
#include <string>
std::string from_pattern(std::string pattern) {
int i{0};
std::map<char, int> m;
std::ostringstream s;
for (char c : pattern) {