Skip to content

Instantly share code, notes, and snippets.

@fmela
fmela / enumerate-combinations.hxx
Created February 18, 2014 00:04
Enumerate every length-K combination of { 1, 2, ..., N } in ascending lexicographic order.
#include <vector>
#include <cassert>
// Call |f| with every length-K combination of { 1, 2, ..., N }, in ascending
// lexicographic order.
template<typename F>
void enumerate_combinations(size_t N, size_t K, const F& f) {
assert(K <= N);
std::vector<size_t> position;
// Initialize with initial position.
@steve-jansen
steve-jansen / README.md
Last active December 13, 2024 23:29
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
#ifndef PRIORITY_QUEUE_H_
#define PRIORITY_QUEUE_H_
#include <iostream>
#include <vector>
#include <unordered_map>
#include <utility>
#include <functional>
@cotsog
cotsog / .travis.yml
Created July 31, 2015 16:09
.travis.yml for gcc-5 compiler support on Travis CI
sudo: required
script:
- sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
- gcc --version
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5