View rb_tree.cpp
#include <iostream>
#include <memory>
#include <cassert>
enum class node_color {
template<typename DataType>
View .cpp
#include <iostream>
#include <bitset>
int main() {
for (std::bitset<10> zero(1); zero != 0; zero <<= 1)
std::cout << ~zero << '\n';
# This function will try to consume the first
# element of the collection using fn: if fn throws, then
# the element was not consumed and the collection is rotated
# so that the non consumed element is at the end of the collection
# and the second one is now at the beginning;
# if fn doesn't throw then the element is removed from the collection
# and the same algorithm is applied to the second (now first) element.
def consume(collection, fn):
while collection:
View gist:c48124b5431cdda5aab4
[ { id: '46642', val: 10898, name: 'r-martinho-fernandes' },
{ id: '16102', val: 9558, name: 'cat-plus-plus' },
{ id: '298661', val: 4516, name: 'puppy' },
{ id: '174614', val: 4261, name: 'tony-the-lion' },
{ id: '85371', val: 4167, name: 'sehe' },
{ id: '252000', val: 4069, name: 'fredoverflow' },
{ id: '1804599', val: 4018, name: 'elyse' },
{ id: '71141', val: 3657, name: 'etienne-de-martel' },
{ id: '500104', val: 3544, name: 'xeo' },
{ id: '140719', val: 3508, name: 'sbi' },

Why is the codomain useful?

In set theory we have that a domain is the set of all inputs for which a function is defined and the image is the set of possible outputs given those inputs. You would think this would be enough, but no: we also have the concept of codomain, which is the set of all possible outputs and some.

This also leads to the distinction between "surjective" functions and non-"surjective" functions (functions that have the image being equal to the codomain and those that don't, respectively). This distinction seems to provide no useful information about the function itself.

Now, let's make an example, we have:

ƒ : {a, b, c, d} -> {1, 2, 3, 4}
ƒ a = 1
  • lol
  • lel
  • kek
  • top kek
  • rotfl
  • lmao
  • yeah, no
  • no.
  • what
  • wat

Factorio basic rules

  1. Don't be a dick
    • a. The player that hosts has to retrieve the most recent save
    • b. The player that originally hosted has to replace the old save with the new one at the end of the match
    • c. The player whose responsibility is to replace the old save can delegate the job to someone else upon agreement
  2. Destroying property requires consent to those that put it down
  3. Don't kill other players
  4. Autosave period must be set to 15 minutes
View driving_slots.sql
create view total_driving_slots as (
select week_day,
count(id) as total_count
from driving_slots
group by week_day, time
create view free_driving_slots as (
select week_day,
View quick_sort.cpp
namespace detail {
template<typename It>
It partition(It begin, It end) {
if (begin == end) return end;
auto pivot = *(end - 1);
auto left = begin; // left partion past the end
for (auto right = begin; right != end; ++right) {
if (*right <= pivot) {
std::iter_swap(left, right);
View gist:7f6d4ce58edbceec5f16
import ninja_syntax
import itertools
import os
import fnmatch
import re
import sys
import argparse