Skip to content

Instantly share code, notes, and snippets.

View mklca's full-sized avatar

Mikaela Allan mklca

View GitHub Profile
@mklca
mklca / test_type_list.cc
Last active December 10, 2015 16:16
Type-level list and basic operations
// Test suite for type_lists
// The tests are all static asserts so that successful compilation of this
// translation unit indicates all tests passed.
#include <cstdlib>
#include <type_list.hpp>
using std::is_same;
@mklca
mklca / gl-ar750s-uboot-dump.log
Created December 29, 2018 23:16
GL-AR750S Bootloader Dump
U-Boot 1.1.4-ga35cd45d-dirty (Jun 22 2018 - 12:48:24)
ar750s - Dragonfly 1.0DRAM:
sri
ath_ddr_initial_config(278): (ddr2 init)
ath_sys_frequency: cpu 775 ddr 650 ahb 258
Tap values = (0x10, 0x10, 0x10, 0x10)
128 MB
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16MB, sector count = 256
@mklca
mklca / recorder.cpp
Created March 15, 2019 15:59
Sketch of Recorders
template<typename D, typename T>
struct base_last_match_recorder {
// Exploits CRTP to "up-reference" this instance from the perspective of the
// derived class D
void operator()(const T &v, int p) {
if(static_cast<D*>(this)->match(v)) {
static_cast<D*>(this)->position = p;
static_cast<D*>(this)->value = v;
}
}
@mklca
mklca / move-call.cc
Created May 26, 2020 23:10
Attempting to build a call-at-most-once functor
#include <iostream>
#include <utility>
using namespace std;
struct F {
F() = default;
F(const F&) = delete;
F& operator =(const F&) = delete;
@mklca
mklca / stringdistance.cpp
Created October 8, 2020 16:52
Jaro and Jaro-Winkler String Distance Metrics
double jaro_string_similarity(boost::string_ref a, boost::string_ref b)
{
using std::cbegin;
using std::cend;
using std::distance;
if(a.empty()) {
return b.empty() ? 1.0 : 0.0;
}