Skip to content

Instantly share code, notes, and snippets.

View ryanjoneil's full-sized avatar
🕴️

Ryan O'Neil ryanjoneil

🕴️
View GitHub Profile
@ryanjoneil
ryanjoneil / foo.cpp
Created August 14, 2014 17:00
subverting private in C++
#include <iostream>
#define private public
#include "foo.hpp"
using namespace std;
int main() {
Foo f(3);
cout << f.bar << endl;
@ryanjoneil
ryanjoneil / routing-preprocessing-part-1
Created June 27, 2014 17:32
preprocessing for routing problems, part 1
# Code for the adventures in optimization post:
# preprocessing for routing problems: part 1
library(datasets)
library(zipcode)
data(zipcode)
# Alexandria, VA is not in Normandy, France.
zipcode[zipcode$zip=='22350', c('latitude', 'longitude')] <- c(38.863930, -77.055547)
@ryanjoneil
ryanjoneil / gist:75dcb54d069ed7200b13
Created June 23, 2014 20:07
Poor man's Python version of R's rainbow(...) function.
from itertools import cycle
rainbow = cycle([
'#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#000000',
'#800000', '#008000', '#000080', '#808000', '#800080', '#008080', '#808080',
'#C00000', '#00C000', '#0000C0', '#C0C000', '#C000C0', '#00C0C0', '#C0C0C0',
'#400000', '#004000', '#000040', '#404000', '#400040', '#004040', '#404040',
'#200000', '#002000', '#000020', '#202000', '#200020', '#002020', '#202020',
'#600000', '#006000', '#000060', '#606000', '#600060', '#006060', '#606060',
'#A00000', '#00A000', '#0000A0', '#A0A000', '#A000A0', '#00A0A0', '#A0A0A0',
'#E00000', '#00E000', '#0000E0', '#E0E000', '#E000E0', '#00E0E0', '#E0E0E0'