This file contains 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
project(project-name) | |
cmake_minimum_required(VERSION 3.11) | |
file(GLOB headers "src/*.hpp") | |
file(GLOB sources "src/*cpp") | |
add_executable(target-name ${headers} ${sources}) | |
target_compile_features(target-name PUBLIC cxx_std_20) |
This file contains 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
#! /usr/bin/python3 | |
from typing import * | |
from dataclasses import dataclass | |
@dataclass | |
class Node: | |
neighbours: List[int] | |
tmp: Set[Tuple[int,...]] |
This file contains 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
# from https://stackoverflow.com/questions/15390807/integer-square-root-in-python | |
def isqrt(n): | |
x = n | |
y = (x + 1) // 2 | |
while y < x: | |
x = y | |
y = (x + n // x) // 2 | |
return x |
This file contains 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
/// CC-0 2019, Florian Weber | |
#include <cassert> | |
#include <cstdint> | |
#include <tuple> | |
#include <type_traits> | |
#include <utility> | |
namespace impl { | |
template <std::size_t Index, typename Value, typename... OutIt> |
This file contains 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 <algorithm> | |
#include <functional> | |
#include <iostream> | |
#include <iterator> | |
#include <string> | |
#include <unordered_map> | |
#include <vector> | |
template <typename KeyType, KeyType Key, typename Listener> | |
struct event_t { |
This file contains 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 scalar_product(lhs, rhs): | |
return sum((l*r for l,r in zip(lhs, rhs))) | |
def possible_sums(primes): | |
n = len(primes) | |
factors = ([(2*int(x) - 1) for x in f"{m:0{n}b}"] for m in range(2**n)) | |
return sorted({ scalar_product(primes, factor) for factor in factors }) | |
def some_primes(): |
This file contains 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 <array> | |
#include <cstddef> | |
#include <cstdint> | |
#include <iomanip> | |
#include <iostream> | |
#include <vector> | |
/* | |
Copyright: Boaz Segev 2019, Florian Weber 2019 | |
License: MIT |
This file contains 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
use std::error::Error; | |
pub trait ResultIterator { | |
type ValueType; | |
type ErrorType; | |
fn fold_results<Acc, Fun>(self, init: Acc, fun: Fun) -> Result<Acc, Self::ErrorType> | |
where | |
Fun: Fn(Acc, &Self::ValueType) -> Acc; | |
} |
This file contains 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
#! /bin/sh | |
if [[ $# < 1 ]]; then | |
echo "missing argument" >&2 | |
exit 1 | |
fi | |
INPUT="$1" | |
ARCHIVE=$(basename "$INPUT") |
This file contains 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
*** Fatal Error *** | |
Address not mapped to object (signal 11) | |
Address: (nil) | |
System: Linux miata 4.15.15-1-ARCH #1 SMP PREEMPT Sat Mar 31 23:59:25 UTC 2018 x86_64 | |
Executing: gdb --quiet --batch --command=/tmp/gdb-respfile-3JpxEC | |
[New LWP 25010] | |
[New LWP 25011] | |
[New LWP 25012] |
NewerOlder