Skip to content

Instantly share code, notes, and snippets.

View milibopp's full-sized avatar

Emilia Bopp milibopp

View GitHub Profile
@milibopp
milibopp / gist:5729280
Last active December 18, 2015 04:59
tox fails on matplotlib
(matplotlib)eduard@sagittaron $ tox -e py27
GLOB sdist-make: /home/eduard/dev/matplotlib/setup.py
py27 inst-nodeps: /home/eduard/dev/matplotlib/.tox/dist/matplotlib-1.4.x.zip
py27 runtests: commands[0]
WARNING:test command found but not installed in testenv
cmd: /usr/bin/sh
env: /home/eduard/dev/matplotlib/.tox/py27
Maybe forgot to specify a dependency?
py27 runtests: commands[1]
E....................................................................................................................................................................................................................................K...K...................EEE...........................................................................................................................................................................................K.................................................................................................................................................................................................
def test_weak_and_lazy_loading():
'''Test loading/saving of model references'''
class ChainMember(Model):
'''This is a simple infinite chain of models referencing each other.'''
def __init__(self, number, prev_member=None, next_member=None):
Model.__init__(self)
self.number = number
self.prev_member = ref(prev_member, prev_member.model_id if prev_member is not None else None)
#! /usr/bin/env python
'''Plot the output of the planet-disk simulation.'''
from __future__ import division
import sys
from soapp.plot.voronoi import voronoi
from soapp.parser.arepo.parser import ArepoParser
@milibopp
milibopp / rust_trait.ll
Created March 4, 2014 11:20
LLVM IR of some rust code
; ModuleID = 'loop_trait.rs'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"struct.std::unstable::intrinsics::TypeId[#1]" = type { i64 }
%str_slice = type { i8*, i64 }
%"enum.std::any::Void[#1]" = type {}
%struct.SumLinearTermsKernel = type { double, double, i64 }
%"enum.std::option::Option<int>[#1]" = type { i8, [7 x i8], [1 x i64] }
%"struct.std::fmt::Argument[#1]" = type { void (%"enum.std::result::Result<(),std::io::IoError>[#1]"*, %"enum.std::any::Void[#1]"*, %"struct.std::fmt::Formatter[#1]"*)*, %"enum.std::any::Void[#1]"* }
@milibopp
milibopp / rcmut.rs
Created March 5, 2014 14:14
Mutable reference counted objects
use std::rc::Rc;
use std::cell::{RefMut, RefCell};
struct Stuff{
i: int,
}
fn main() {
// Allocate ref-counted stuff
let rcref: Rc<RefCell<Stuff>> = Rc::new(RefCell::new(Stuff{i: 1}));
@milibopp
milibopp / mpl_multipage_pdf.py
Last active December 17, 2019 21:29
Matplotlib multiple pages in PDF
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
with PdfPages('multipage.pdf') as pp:
for i in range(0, 10):
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
x = np.linspace(0, 10)
@milibopp
milibopp / .gitignore
Last active August 29, 2015 14:11
rust-ice-19768
/target
/Cargo.lock
@milibopp
milibopp / parametric.rs
Created December 16, 2014 13:03
Compare Vector3 implementations
struct Addition;
struct Multiplication;
trait Group<Op> {
fn group_op(&self, rhs: &Self) -> Self;
fn unital() -> Self;
fn inverse(&self) -> Self;
}
trait AddGroup<AddOp>: Group<AddOp> {}
with import <nixpkgs> {};
pkgs.python.pkgs.buildPythonPackage rec {
name = "vispy-master";
src = pkgs.fetchgit {
url = "https://github.com/vispy/vispy";
sha256 = "1zm0gglvzlhliicwv5rm9nv34f1ql2i5vns8ybqr78r4bcz0f6dp";
rev = "38001b70d54a5519eb296d44a196c081fcbd7fad";
};
@milibopp
milibopp / analysis.nix
Created July 7, 2017 12:54
Vispy usage with redundant fontconfig
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "data-analysis";
LD_LIBRARY_PATH = "${pkgs.fontconfig.lib}/lib";
buildInputs = [
(pkgs.python27.withPackages (packages: with packages; [
h5py