Skip to content

Instantly share code, notes, and snippets.

View cgranade's full-sized avatar

Cassandra Granade cgranade

View GitHub Profile
@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:

@cgranade
cgranade / tensor_contract_example
Created December 1, 2014 06:39
QuTiP Example: Superoperators, Pauli Basis and Channel Contraction
{
"metadata": {
"name": "",
"signature": "sha256:d7454350e8574bbb2d317221e2bcdea00fd12b8579a7168fea3b30a93785dc20"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@cgranade
cgranade / scirate.user.js
Created January 12, 2015 23:04
Link arXiv → SciRate
// ==UserScript==
// @name Link arXiv → SciRate
// @namespace http://www.cgranade.com/
// @version 0.1
// @description Adds links to SciRate from arXiv papers.
// @match http://arxiv.org/abs/*
// @copyright 2015+, You
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// ==/UserScript==
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgranade
cgranade / gist:8f7fce10b6deaf06ce01
Last active August 29, 2015 14:19
Additional documentation for QuTiP issue report "extra dims and mul".
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
(*Suppose that data is stored in a CSV-like format, with newline-delimted rows of comma-separated fields.*)
StringSplit[#, ","]& /@ StringSplit["a,b,c\nd,e,f", "\n"]
(*If certain fields are missing, then let's suppose this is represented by an empty string as the contents for that field.*)
StringSplit[#, ","]& /@ StringSplit["a,,c\nd,e,f", "\n"]
(*This is inconvienent, so let's write a function to parse that as the special values Missing[].*)
MarkMissingValues[dataStr_] := Map[
Function[row, StringSplit[row, ","]],
StringSplit[dataStr, "\n"]
@cgranade
cgranade / gist:dc7bca3d990412b8543e
Created July 15, 2015 01:29
Defeating {revtex4-1} and @control with the power of unforgivable hacks.
\documentclass[aps,pra,twocolumn,superscriptaddress,nofootinbib]{revtex4-1}
%=============================================================================
% BEGIN UNFORGIVABLE HACKS
%=============================================================================
\makeatletter
\def\@bibdataout@aps{%
\immediate\write\@bibdataout{%
@CONTROL{%
apsrev41Control,author="08",editor="1",pages="0",title="0",year="1"%
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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) {