Skip to content

Instantly share code, notes, and snippets.

View cgranade's full-sized avatar

Cassandra Granade cgranade

View GitHub Profile
@cgranade
cgranade / x
Created October 28, 2008 20:29 — forked from anonymous/x
xpc-interfaces: Provides a Ubiquity command to query interfaces supported by a contract ID.
function get_ifaces(component) {
// WARNING: This is implemented in a stupid way.
var nsis = Components.interfaces.nsISupports;
var cc = Components.classes;
var clazz = cc[component].createInstance(nsis);
var ifaces = Array();
for each (iface in Components.interfaces) {
if (clazz instanceof iface) {
@cgranade
cgranade / x
Created November 13, 2008 21:16
Basic first attempt at a command to run programs on the shell.
/* This is a template command */
CmdUtils.CreateCommand({
name: "shell",
icon: "http://example.com/example.png",
homepage: "http://sites.google.com/site/cgranade/",
author: { name: "Christopher Granade", email: "cgranade@gmail.com"},
license: "GPL",
description: "A short description of your command",
#!/usr/bin/python
##
# overlay.py: small daemon for showing web pages in an overlay
##
# (c) 2010 Christopher E. Granade (cgranade@gmail.com).
# Licensed under GPL v3.
##
# WARNING: This is still a proof of concept. Do not use it
# without improving it first, unless you plan on filing bug
@cgranade
cgranade / storyyield.py
Created November 2, 2011 04:47
Proof of concept for story scripting in Python with coroutines.
#!/usr/bin/python
##
# storyyield.py: Proof of concept for story scripting in Python with coroutines.
##
# (c) 2011 Christopher E. Granade (cgranade@cgranade.com).
# Licensed under GPL v3.
##
from __future__ import print_function
#!/usr/bin/env mpiexec -n 4 python
# -*- coding: utf-8 -*-
##
# ssp.py: Demonstration of stupid simple pooling using mpi4py.
##
# By Christopher E. Granade, 2013.
# Commited to the public domain except where otherwise noted.
##
## IMPORTS #####################################################################
@cgranade
cgranade / cl_cos_model.py
Created August 2, 2013 02:48
This module demonstrates the use of OpenCL to accelerate sequential Monte Carlo by implementing a simple cosine-likelihood model as an OpenCL kernel. When run as a script, this module then compares the performance of the OpenCL-accelerated model to the pure-NumPy model implemented in the QInfer project.
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# cl_cos_model.py: Demonstration of OpenCL-powered SMC.
##
# © 2013 Christopher E. Granade (cgranade@gmail.com).
#
# Licensed under the AGPL version 3.
##
# This program is free software: you can redistribute it and/or modify
@cgranade
cgranade / log_calls.py
Created August 13, 2013 02:34
This module demonstrates a basic application of the Python Standard Library's logging module by using logging to implement a decorator that logs all calls to a function, method or property.
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# log_calls.py: Decorator for logging calls to a function.
##
# © 2013 Christopher E. Granade (cgranade@gmail.com).
#
# Licensed under the AGPL version 3.
##
# This program is free software: you can redistribute it and/or modify
@cgranade
cgranade / mathjax-gist.user.js
Created January 4, 2014 23:48
Adds MathJax support to GitHub Gists. Useful for working with Markdown documents.
// ==UserScript==
// @name MathJax for Gists
// @include *://gist.github.com/*
// @version 0.1
// @description Adds MathJax support to Gists.
// ==/UserScript==
if ((window.unsafeWindow == null ? window : unsafeWindow).MathJax == null) {
var script = document.createElement("script");
script.type = "text/javascript";
@cgranade
cgranade / test-mat.npy
Last active August 29, 2015 14:02
Test case for slowdown bug in SciPy 0.13 expm.

Keybase proof

I hereby claim:

  • I am cgranade on github.
  • I am cgranade (https://keybase.io/cgranade) on keybase.
  • I have a public key whose fingerprint is 7950 2540 D90E 791F A91F 6AFC 7B70 49DA 0677 5403

To claim this, I am signing this object: