Skip to content

Instantly share code, notes, and snippets.

@rossant
rossant / numpy_tricks
Last active February 26, 2017 19:28
Numpy performance tricks
{
"metadata": {
"name": "numpy_tricks"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@rossant
rossant / ruzzle
Created February 21, 2013 00:32
Playing with Ruzzle in Python
{
"metadata": {
"name": "ruzzle"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@rossant
rossant / ascii_art
Last active December 15, 2015 01:19
ASCII art in the IPython notebook.
{
"metadata": {
"name": "ascimage"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@rossant
rossant / velib
Created May 5, 2013 14:12
Playing with Velib' open data.
{
"metadata": {
"name": "Velib"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@rossant
rossant / correlograms.ipynb
Last active December 17, 2015 04:29
Pure Python and Cython code of an algorithm computing all pairwise correlograms between all neurons, given a set of spike trains.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rossant
rossant / raytracing.py
Last active December 24, 2023 12:50
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@rossant
rossant / 1500_women_free.ipynb
Last active December 20, 2015 14:59
15th FINA WORLD CHAMPIONSHIPS, Barcelona (ESP)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rossant
rossant / ipynb2txt.py
Created August 10, 2013 19:33
Convert an IPython notebook to console-like text output.
# Conversion from JSON to TXT.
import os
import json
def process_input(cell):
if 'prompt_number' not in cell:
return ''
prefix = "In [{0:s}]: ".format(str(cell['prompt_number']))
spaces = ' ' * len(prefix)
contents = prefix + cell['input'][0]
@rossant
rossant / cache_tests.ipynb
Created October 7, 2013 17:31
Tests with cache extension in the IPython notebook.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.