This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "A.h" | |
#include <iostream> | |
class A_impl { | |
public: | |
void f() const { | |
std::cout << "F!" << std::endl; | |
} | |
}; | |
A::A(): _obj{std::make_unique<A_impl>()} {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main(int argc, char* argv[]) { | |
{ | |
// a typical embedded loop check can require a check for success and | |
// multiple checks to unroll | |
bool success = false; | |
int i = 0, j = 0; | |
for (i = 0; i < 50; ++i) { | |
for (j = 0; j < 50; ++j) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
import time | |
# https://docs.python.org/3/howto/sorting.html#sortinghowto | |
def cmp_to_key(mycmp): | |
'Convert a cmp= function into a key= function' | |
class K: | |
def __init__(self, obj, *args): | |
self.obj = obj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef INDEX_MANAGEMENT_H | |
#define INDEX_MANAGEMENT_H | |
#include <vector> | |
#include <Eigen/Dense> | |
#include <Eigen/Sparse> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy as np | |
from struct import unpack | |
def strlist_to_vec(arr): | |
return tuple(float(x) for x in arr) | |
class Facet: | |
dtype = np.dtype([ | |
('N', np.float32,(3)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Eigen/Dense> | |
#include <iostream> | |
#include <mtao/geometry/grid/grid.h> | |
template<class ArgType, int D> | |
struct col_offset_helper { | |
typedef Eigen::Matrix<typename ArgType::Scalar, | |
D, | |
Eigen::Dynamic, | |
Eigen::ColMajor, | |
D, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Eigen/Dense> | |
#include <chrono> | |
#include <iostream> | |
template <typename Func> | |
int run(int size, const std::string& name, Func&& f, bool print=false) { | |
Eigen::VectorXd D = Eigen::VectorXd::Random(size); | |
Eigen::VectorXd x = Eigen::VectorXd::Random(size); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_range(s): | |
if type(s) == range: | |
return s | |
elif type(s) == slice: | |
return range(s.start,s.stop,s.step if s.step else 1) | |
elif type(s) == tuple: | |
return range(*s) | |
else: | |
return range(s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ ! -e words.txt ]; then | |
wget https://raw.githubusercontent.com/dwyl/english-words/master/words.txt > /dev/null 2&>1 | |
cat words.txt | tr '[:upper:]' '[:lower:]'| sort -u | grep -v "-" | grep -v "\." | grep -v "'" | grep -v "/" | grep -v "&" > /tmp/words_sorted.txt | |
fi | |
rm /tmp/my_dict.txt | |
prefix="$1" | |
grep "^$1" words.txt | head -n 5 | |
charset=$( cat /tmp/words_sorted.txt | grep -o . | sort -u | tr -d "\n" ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string_view> | |
template <size_t... N> | |
bool isInSet(const std::string_view s, const char (&...S)[N]) { | |
return (operator==(s,S) || ...); | |
} | |
int main(int argc, char * argv[]) { |