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
@willkill07
willkill07 / day16.cpp
Created December 16, 2016 21:29
Day16.cpp
#include <chrono>
#include <iostream>
#include <string>
int main(int argc, char**) {
auto start = std::chrono::high_resolution_clock::now();
uint LIM{argc > 1 ? 35651584U : 272U};
std::string in;
in.reserve(LIM << 1); // big buffer
std::cin >> in;
@willkill07
willkill07 / Day13.cpp
Last active December 14, 2016 00:28
Advent of Code Day 13 C++14
#include <iostream>
#include <string>
#include <array>
#include <map>
#include <set>
// A point is just an array of two elements
using Point = std::array<int, 2>;
// We need to add two points to make a new point, so let's write operator+
@willkill07
willkill07 / Day11.cpp
Created December 13, 2016 23:58
Day11 AOC2016 Askalski Improved
// compile with -O3 -march=native -std=c++14
#include <array>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <map>
#include <regex>
#include <string>
#include <unordered_map>
#include <iostream>
#include <string>
#include <array>
#include <map>
#include <set>
using Point = std::array<int, 2>;
inline Point operator+(const Point& p1, const Point& p2) {
return {{std::get<0>(p1) + std::get<0>(p2), std::get<1>(p1) + std::get<1>(p2)}};
@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) {
@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 / 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 / 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>
#!/bin/bash
echo "Regenerating README Table"
if [ -a .commit ]
then
rm -f .commit
cat<<'EOF' > .process.awk
#!/usr/bin/env gawk
BEGIN{
FS = "[| \t]+";
#include <iostream>
#include <array>
#include <algorithm>
#include <numeric>
typedef unsigned long long ULL;
// Delcare the litparser
template<ULL Sum, char... Chars> struct litparser;