Skip to content

Instantly share code, notes, and snippets.

View Jorge-C's full-sized avatar

Jorge Cañardo Alastuey Jorge-C

View GitHub Profile
import unittest
import tempfile
from StringIO import StringIO
from util import open_filepath_or, _is_string_or_bytes
class TestFilePathOpening(unittest.TestCase):
def test_is_string_or_bytes(self):
self.assertTrue(_is_string_or_bytes('foo'))
{
"metadata": {
"name": "",
"signature": "sha256:15a77094831f2163897dc9869989c73223affe2cdbe64be9ce7f3fde40511f15"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import matplotlib
matplotlib.use('webagg')
import numpy as np
from scipy.special import binom
import matplotlib.pyplot as plt
@Jorge-C
Jorge-C / foo.h
Created April 27, 2013 20:42
Weird behaviour
#include <climits>
const int toEnd = INT_MAX;
@Jorge-C
Jorge-C / blitz_bug.py
Created April 27, 2013 13:41
weave.blitz assignment bug.
import numpy as np
from scipy.weave import blitz
import numpy.testing as npt
def test_blitz_bug():
"""Assignment to arr[i:] fails inside blitz expression."""
N = 4
expr_buggy = 'arr_blitz_buggy[{0}:] = arr[{0}:]'
expr_not_buggy = 'arr_blitz_not_buggy[{0}:{1}] = arr[{0}:]'
"""Cool histograms from your gmail account.
Remember to turn on IMAP, and if you're using two-steps verification
(you should) you'll have to request a password just for this (security
"tab" of your account configuration).
"""
from collections import Counter
from itertools import izip
import imaplib