Skip to content

Instantly share code, notes, and snippets.

@mprat
mprat / fixme.py
Last active August 29, 2015 13:56 — forked from damianavila/fixme.py
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Copyright (c) 2013 - Damián Avila
#
# Distributed under the terms of the Modified BSD License.
#
# A little snippet to fix @media print issue printing slides from IPython
#-----------------------------------------------------------------------------
@mprat
mprat / school_test_infographic
Created April 26, 2013 19:10
A very simple GraphViz program to draw a very simple infographic sharing the message that education is not creative.
digraph school_test{
label = "Where does the education happen?";
nodesep=1.2;
node [shape=box];
overlap=false;
"School" -> "Test";
"Test" -> "School";
}
And if it is saved as a .txt, .gv, whatever, then it can be compiled with:
@mprat
mprat / high_school_education_system_with_clumps
Created April 26, 2013 20:18
A system diagram for secondary education at a high level, without any specifics.
digraph high_school_sys{
overlap=scalexy;
nodesep=0.6;
subgraph cluster_after{
label = "After high school";
"College";
"Vocational career";
}
@mprat
mprat / upsert.py
Last active December 24, 2015 02:44 — forked from timtadh/upsert.py
How to compile an INSERT ... ON DUPLICATE KEY UPDATE with SQL Alchemy with support for a bulk insert.
#!/usr/bin/env python
# Copyright (c) 2012, Tim Henderson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@mprat
mprat / mathjax.html
Created March 19, 2017 03:29
Include for mathjax
<!-- Load mathjax -->
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
<!-- MathJax configuration -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true,
processEnvironments: true
@mprat
mprat / jekyll.tpl
Last active January 18, 2024 20:22
nbconvert configuration for converting a Jupyter notebook into an HTML output with images saved separately, intended to be embedded into a Jekyll site.
{%- extends 'display_priority.tpl' -%}
{% block codecell %}
<div class="cell border-box-sizing code_cell rendered">
{{ super() }}
</div>
{%- endblock codecell %}
{% block input_group -%}