Skip to content

Instantly share code, notes, and snippets.

@martijnvermaat
martijnvermaat / userContent.css
Last active August 29, 2015 14:03
Hide comments on Losse Veter (losseveter.nl)
/*
* Hide comments on Losse Veter (losseveter.nl)
*
* Most of the user comments on Losse Veter are either racist or zealot
* epistels about doping. With this Firefox setting, you can enjoy just
* the track and field news.
*
* Edit this file and copy it as userContent.css into your Firefox
* profile-directory/chrome/
*/
@brentp
brentp / euler_52.py
Created July 18, 2012 21:19
euler_52
import itertools
from collections import Counter
def euler_52():
for i in itertools.count(1):
nums = [str(i * j) for j in range(1, 7)]
s = frozenset(nums[0])
sall = set()
sall.update(*nums)
if sall == s:
@vsbuffalo
vsbuffalo / ten-commandments.md
Created August 10, 2012 06:02
The Ten Commandments of Scientific Coding

The Ten Commandments of Scientific Coding

  1. Thou shall use version control.

  2. Thou shall comment thy code.

  3. Thou shall use existing libraries whenever possible.

  4. Thou shall try to unit test.

@takluyver
takluyver / ipytables.py
Created March 6, 2013 11:57
IPyTables
class TableCell(object):
bg_colour = None
def __init__(self, value, header=False, bg_colour=None, text_colour=None):
self.value = value
self.header = header
self.bg_colour = bg_colour
self.text_colour = text_colour
def _make_css(self):
@jlesquembre
jlesquembre / postmkvirtualenv
Created March 15, 2012 08:12
Creates a symlink to PyQt libraries when a new virtual environment is created
#!/bin/bash
# This hook is run after a new virtualenv is activated.
# ~/.virtualenvs/postmkvirtualenv
libs=( PyQt4 sip.so )
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
var=( $(which -a $python_version) )
get_python_lib_cmd="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
@takluyver
takluyver / README.md
Created September 6, 2014 21:44
Flatten notebooks for git diff

Copy nbflatten.py to somewhere on $PATH. Then, in the root of a git repository, run these commands:

echo "*.ipynb diff=ipynb" >> .gitattributes 
git config diff.ipynb.textconv nbflatten.py

When you change a notebook and run git diff, you'll see the diff of flattened, simplified notebooks, rather than the full JSON. This does lose some information (metadata, non-text output), but it makes it easier to see simple changes in the notebook.

This doesn't help with merging conflicting changes in notebooks. For that, see nbdiff.org.

@hauspie
hauspie / git-log-to-tikz.rb
Created April 16, 2012 09:20
Extract git history to tikz picture
#!/usr/bin/env ruby
# A small ruby script to extract a git history to a tikz picture
# Author: Michael Hauspie <Michael.Hauspie@lifl.fr>
#
# Not clean code, not always working well, but does its job in most of the cases I needed :)
# A commit object
class Commit
attr_accessor :hash
@martijnvermaat
martijnvermaat / README.md
Last active February 7, 2022 09:06
The IPython Notebook on an SGE cluster

IPython Notebook on an SGE cluster

This guide documents how we set up an easy workflow for using the IPython Notebook on our compute cluster managed with Sun Grid Engine (SGE).

Summary: We provide a script to the cluster users that runs qrsh to schedule an ipython notebook job using SSL and password protection.

Installing IPython

@martijnvermaat
martijnvermaat / raspberry-pi-config.md
Last active February 3, 2023 01:53
Notes on my Raspberry Pi server config

Notes on my Raspberry Pi server config

This describes how I installed and configured my Raspberry Pi model B (512MB).

The Pi is mainly used as SSH jump host, IRC client, Git server, backup fileserver, etc. It doesn't need stellar performance, it just has to be cheap, low in power usage, and secure.

Raspbian on encrypted root

@martijnvermaat
martijnvermaat / gitlab-ipython-notebook.md
Last active May 8, 2023 00:53
View IPython notebooks in GitLab

Viewing IPython notebooks in GitLab

GitLab is open source software to collaborate on code (a GitHub clone to run on your own server). Clicking a blob (a file in a repository) in GitLab shows a nice rendering if GitLab supports the file type (e.g., images, Markdown documents), or its content as plain text otherwise. The patch described here adds support to GitLab for rendering IPython notebooks (.ipynb files).