Skip to content

Instantly share code, notes, and snippets.

Alastair Rankine randomphrase

View GitHub Profile
View collinear.cpp
#define BOOST_TEST_MODULE collinear
#include <boost/test/unit_test.hpp>
#include <boost/range/algorithm/generate.hpp>
#include <set>
#include <cmath>
struct Point {
int x;
int y;
randomphrase /
Created Apr 29, 2015
Example how bash function input/output can be used to compose
# Creates an XML element from the first parameter. Remaining parameters and all stdin are copied to stdout.
function elem() {
local name=$1
echo -n "<$name>"
echo -n $*
[[ ! -t 0 ]] && cat
echo "</$name>"
View gist:489dc5e6deb2e4839671

Keybase proof

I hereby claim:

  • I am randomphrase on github.
  • I am randomphrase ( on keybase.
  • I have a public key whose fingerprint is 64E4 B67C D2B7 EEC4 63C9 AA74 F63A 9AD9 E44B 21C7

To claim this, I am signing this object:

View array_copy.cpp
// -*- mode: c++; c-basic-offset: 4 -*-
#include <boost/timer.hpp>
#include <algorithm>
#include <random>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <stdexcept>
const unsigned WARMUP = 5;
randomphrase / cmdoptions.cpp
Last active Jan 10, 2019
Demonstration of how to do subcommand option processing with boost program_options
View cmdoptions.cpp
#define BOOST_TEST_MODULE subcommand options
#include <boost/test/unit_test.hpp>
#include <boost/program_options.hpp>
#include <boost/variant/variant.hpp>
#include <boost/variant/get.hpp>
struct GenericOptions {
bool debug_;
View semantic-browse-c++-doc.el
(defun c++-type-at (point)
"Use semantic to determine the fully namespace-qualified type of the symbol at POINT."
(interactive "d")
(let* ((ctxt (semantic-analyze-current-context point))
(pf (reverse (oref ctxt prefix)))
(lastname (pop pf))
(tag (if (semantic-tag-p lastname) lastname (car pf)))
(names (append
(when (semantic-tag-p tag)
View gist:7744453
alastair@lulu ~/.emacs.d ±master⚡ » cask
Contacting host:
Saving file /Users/alastair/.emacs.d/.cask/24.3.1/elpa/archives/org/archive-contents...
Wrote /Users/alastair/.emacs.d/.cask/24.3.1/elpa/archives/org/archive-contents
Contacting host:
Saving file /Users/alastair/.emacs.d/.cask/24.3.1/elpa/archives/marmalade/archive-contents...
Wrote /Users/alastair/.emacs.d/.cask/24.3.1/elpa/archives/marmalade/archive-contents
Contacting host:
Saving file /Users/alastair/.emacs.d/.cask/24.3.1/elpa/archives/melpa/archive-contents...
Wrote /Users/alastair/.emacs.d/.cask/24.3.1/elpa/archives/melpa/archive-contents
randomphrase / 99bob.cpp
Created Aug 7, 2011
99 Bottles Of Beer, using Boost MPL
View 99bob.cpp
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/copy.hpp>
#include <boost/mpl/divides.hpp>
#include <boost/mpl/empty_sequence.hpp>
#include <boost/mpl/equal.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/for_each.hpp>
You can’t perform that action at this time.