Skip to content

Instantly share code, notes, and snippets.

@p2
p2 / autoflask-patch.diff
Created March 5, 2014 22:32
Patch for autoflask to sort docstrings by path and group by endpoint/method
diff --git a/httpdomain/sphinxcontrib/autohttp/flask.py b/httpdomain/sphinxcontrib/autohttp/flask.py
--- a/httpdomain/sphinxcontrib/autohttp/flask.py
+++ b/httpdomain/sphinxcontrib/autohttp/flask.py
@@ -93,7 +93,15 @@
def make_rst(self):
app = import_object(self.arguments[0])
- for method, path, endpoint in get_routes(app):
+
+ # order by paths, remember last path per endpoint
@p2
p2 / csv-to-sqlite.py
Created December 4, 2013 23:35
Quickly create a SQLite table from a CSV/TSV file
#!/usr/bin/python
#
# Read a CSV/TSV with a header row (!) and put it into a new sqlite table
import sys
import csv
import sqlite3
class Importer (object):
@p2
p2 / .profile
Last active August 27, 2021 04:28
BaSH Profile
# Now written for ZSH and using oh-my-zsh
# Install oh-my-zsh as shown in https://github.com/robbyrussell/oh-my-zsh#basic-installation
# Install our custom theme: ln -s ~/profile/p2.zsh-theme ~/.oh-my-zsh/themes/p2.zsh-theme
# Change ~/.zshrc and use:
# ZSH_THEME="p2"
# plugins=()
# source ~/.profile
# -----------------------
# keep history per session (oh-my-zsh sets this to shared)
@p2
p2 / TerminalOutput.sh
Created July 18, 2012 23:59
Error installing gnome-doc-utils
$ brew update
Updated Homebrew from 612e0b1c to c4b88b2a.
==> Updated Formula
ddrescue fbida geeqie
$ brew doctor
Your system is raring to brew.
$ brew uninstall libxml2
Uninstalling /usr/local/Cellar/libxml2/2.8.0...
$ brew install libxml2 --with-python
==> Downloading ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz
@p2
p2 / Custom CSS
Created February 22, 2012 15:28
Tumblr Blog Page
h3 {
margin-bottom: 0.5em;
}
#header {
margin-bottom: 40px;
padding-top: 40px;
}
#header h1 a.no_header {
font-family: Palatino, Helvetica, sans-serif;
@p2
p2 / convert.html
Created August 22, 2011 04:29
A bookmarklet that converts inches to cm and feet to m. Can be expanded to convert other units as well. Visit www.ossus.ch/Convert.html, drag the link shown there to your bookmark bar and when you're on a website that needs conversion, click the boomarkle
<h1>Convert Bookmarklet</h1>
<p>A bookmarklet to (currently) convert <b>feet to cm</b> and <b>inches to Meter</b> on any website.</p>
<p>Drag this link to your bookmark bar and click it when you're on a website you want to convert: <a href="javascript:(function(){var head=document.getElementsByTagName('head')[0],script=document.createElement('script');script.type='text/javascript';script.src='http://www.ossus.ch/convert.js?'+Math.floor(Math.random()*99999);head.appendChild(script);})(); void 0">Convert</a>
</p>