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
#demonstration of hack to declaratively set param_storage_class declaratively using a decorator | |
#also demonstrates how to write an IPN handler with Flask | |
from flask import Flask, make_response | |
from itertools import chain | |
app = Flask(__name__) | |
#Normally this parameter would come from a config | |
IPN_URLSTRING = 'https://www.sandbox.paypal.com/cgi-bin/webscr' | |
IPN_VERIFY_EXTRA_PARAMS = (('cmd', '_notify-validate'),) |
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
// -*- compile-command: "clang++ -std=c++11 -stdlib=libc++ -Wall -Werror func.cc -o func" -*- | |
#include <iostream> | |
#include <functional> | |
#include <utility> | |
#include <iomanip> | |
//The ugly beast we're wrapping | |
template <typename T1, typename T2, typename T3> | |
struct Hooks3 { | |
virtual bool Fire (int *, T1 t1, T2 t2, T3 t3) { return false; } |
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
// -*- compile-command: "clang++ -ggdb -o brace_initializer -std=c++0x -stdlib=libc++ brace_initializer.cpp" -*- | |
#include <string> | |
#include <ostream> | |
#include <memory> | |
#include <iostream> | |
#include <sstream> | |
#include <new> | |
class Foo { |
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
// -*- compile-command: "clang++ -ggdb -o dont_terminate -std=c++0x -stdlib=libc++ dont_terminate.cpp" -*- | |
// Demonstration of the problem that can happen with using std::uncaught_exception() to determine | |
// whether it is safe to throw from within a destructor | |
// Problem identified, as always, by GOTW: http://www.gotw.ca/gotw/047.htm | |
#include <stdexcept> | |
#include <iostream> | |
#include <cassert> | |
using namespace std; |
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/bash | |
# | |
# Setups up a new CentOS machine on Joyent running a Salt minion talking to your salt master. From there, you can do the rest of your setup work from the Salt Master. | |
# Requires Joyent Command Line SDK be installed as well as Node's jsontool (npm install jsontool) | |
# If you don't provide a Joyent ID, the code assumes the master is labeled with metadata "salt-role=master" or with "role=salt-master" | |
# Tweak these variables should have done anything creative with your salt setup | |
SALT_ROOT=/ | |
SALT_MASTER_UID=root |
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/python | |
# Save this file as protoc-gen-depends, put it in your path (executable) and add "--depends-out=/whatever/path" to your protoc invocation | |
from google.protobuf.compiler.plugin_pb2 import CodeGeneratorRequest,CodeGeneratorResponse | |
from sys import stdin,stdout | |
req = CodeGeneratorRequest() | |
req.MergeFromString(''.join(stdin.readlines())) | |
res = CodeGeneratorResponse() |
NewerOlder