Skip to content

Instantly share code, notes, and snippets.

@wilsaj
wilsaj / flaskplotlib.py
Created March 9, 2011 13:09
Example of rendering a matplotlib image directly to Flask view
from flask import Flask, make_response
app = Flask(__name__)
@app.route("/simple.png")
def simple():
import datetime
import StringIO
import random
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@yanofsky
yanofsky / LICENSE
Last active June 5, 2024 21:51
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@sloria
sloria / bobp-python.md
Last active July 21, 2024 04:44
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@deemson
deemson / late_binding.py
Created June 18, 2014 13:02
Demo of late binding in Python's closures and how to avoid it when needed
# Demo of late binding in Python's closures and how to avoid it when needed
functions = []
for n in [1, 2, 3]:
def func(x):
return n*x
functions.append(func)
# You would expect this to print [2, 4, 6]
print(
@kidpixo
kidpixo / jupyter_shortcuts.md
Last active July 1, 2024 05:40
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Warning This is SEVERELY outdated, the current jupyter version is > 6.X, please refer to your current jupyter notebook installation!

Disclaimer : I just copied those shortcuts from Jupyter Menú > Help > Keyboard Shortcuts, I didn't wrote them myself.

Check your current shortcuts in your Help, shortcuts coule have been modified by extensions or your past self.

Toc

Keyboard shortcuts

@dennisobrien
dennisobrien / bokeh_datatable_filtered.py
Last active June 5, 2021 00:09
Filter a Bokeh DataTable using multiple filter widgets. Runs in a Jupyter notebook.
import bokeh.embed
import bokeh.io
import bokeh.models
import bokeh.models.widgets
import bokeh.plotting
import pandas as pd
from pandas_datareader import wb
bokeh.plotting.output_notebook()