Skip to content

Instantly share code, notes, and snippets.

View rowanj's full-sized avatar
🐧
Seizing the machines of production

Rowan James rowanj

🐧
Seizing the machines of production
View GitHub Profile
@rowanj
rowanj / sign.py
Last active February 8, 2023 18:13
Python script for signing an OS X application such that it runs without warning users about being un-signed
#!/usr/bin/env python
# Original work by Rowan James at https://gist.github.com/rowanj/5475988
# This is free and unencumbered software released into the public domain.
# http://unlicense.org
import argparse
import subprocess
import os
import glob
#include "Bind.hpp"
namespace OTR
{
template <typename Object>
int objectID(Object const& object)
{
return reinterpret_cast<intptr_t>(&object);
}
template <typename Sig, typename Func>
@rowanj
rowanj / user-config.jam
Created November 12, 2012 11:17
user-config.jam for targeting iOS with Boost.Build and Clang
local xcCLANG = [ SHELL "xcrun -sdk iphoneos -f clang" ] ;
local CLANG = [ MATCH "([^
]*)" : $(xcCLANG) ] ;
ECHO "CLANG = $(CLANG)" ;
local xcDEVDIR = [ SHELL "xcode-select --print-path" ] ;
local DEVDIR = [ MATCH "([^
]*)" : $(xcDEVDIR) ] ;
ECHO "DEVDIR = $(DEVDIR)" ;
@rowanj
rowanj / Tue 6 Nov 2209.note.html
Created November 6, 2012 12:08
Testing IE 8 specific notebook rendering
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1">
<title></title>
<meta name="notebook-annotation-version" content="2">
<style type="text/css">.page {
/* PAGE BACKGROUND */
background: white;
@rowanj
rowanj / SharedPtrEx.hpp
Created October 12, 2012 05:09
Shared pointer implementation that throws exceptions on NULL
//
// SharedPtrEx.hpp
// Phere Shared Ptr
//
// Created by Rowan James on 12/10/12.
// Copyright 2012 Rowan James. All rights reserved.
//
#ifndef PHERE_UTIL_SHARED_PTR_HPP
#define PHERE_UTIL_SHARED_PTR_HPP
@rowanj
rowanj / gist:3023854
Created June 30, 2012 13:54
Default arguments aren't overloads
#include <iostream>
using namespace std;
// #include <some header>
void foo(int x, int y);
// but we always use y = 2 with foo
void foo(int x, int y = 2);
int main()
@rowanj
rowanj / gist:3004102
Created June 27, 2012 13:36
Using a single Boost.Pool with a class heirarchy
struct Base{virtual ~Base(){}; int x;};
struct Derived : public Base {int y;};
#import <boost/pool/pool_alloc.hpp>
template <typename T>
T* construct()
{
T* result = reinterpret_cast<T*>(boost::pool_allocator<Base>::pool_allocator::allocate(sizeof (T)));
@rowanj
rowanj / gist:3004098
Created June 27, 2012 13:35
Using multiple Boost pools with a class heirarchy
struct Base{virtual ~Base(){}; int x;};
struct Derived : public Base {int y;};
#import <boost/pool/object_pool.hpp>
namespace pools
{
boost::object_pool<Base> Base;
boost::object_pool<Derived> Derived;
}
// istreamLikeClass is
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
boost::iostreams::gzip_decompressor decompressor;
in.push(decompressor);
in.push(is);
stringstream ss (stringstream::in | stringstream::out);
#import <iostream>
struct Octree {
Octree() : index(created++){}
void print_index()
{
std::cout << "print_index() " << index << std::endl;
}
int index;
static int created;