Instantly share code, notes, and snippets.

View graph_gist_template.adoc

Plant database schema

Introduction

View plant_reproduction_exp.py
from random import choice
types = ['sporophyte', 'gametophyte']
class Plant(object):
def __init__(self, type=None):
self.type = type or choice(types)
View wrapped_ctxmgr.py
from contextlib import contextmanager
def to_mgr(fn):
fn.__converted__ = True
@contextmanager
def fn2(*args, **kwargs):
try:
fn(*args, **kwargs)
View Principles.md

Articles and their respective points

GLOBAL

  • Interactivity
  • Direct manipulation
  • Intuition
  • See the data, see the changes

===============================================================================

View fields_science_combinatorics.py
# -*- coding: UTF-8 -*-
"""Scientific branches."""
from itertools import permutations
from random import choice
branches = {
"Acarology": "study of mites",
"Aceology": "science of remedies, or of therapeutics; iamatology.",
"Acology": "study of medical remedies",
View flask_fsm.py
"""FSM abstraction in python for flask.
==========================
Requirements:
1. Transition from/to steps
2. Only allow certain transitions
3. Reset FSM once in a certain position (stopping state)
E.g. a form that may then save to a DB and then
View multiline2str.sh
-- https://serverfault.com/questions/72476/clean-way-to-write-complex-multi-line-string-to-a-variable
CURR_PATCH_XML=`cat <<EOF
<?xml version="1.0" encoding="utf-8"?>
<isilon-pkg>
<name>patch-189198</name>
<description> This patch addresses an issue where the SyncIQ isi_mgr_worker process can attempt to open a file located outside the SyncIQ policy's root path and cause the SyncIQ policy to fail.</description>
<pkgcomment>The SyncIQ isi_migr_worker process sometimes attempted to open a file that was moved outside of the SyncIQ policy's root path. If this issue occurred, the SyncIQ job failed</pkgcomment>
<swvers>
<swver>8.0.0.3</swver>
</swvers>
View bmarks_iidex.py
"""Tokenize bookmark titles and create an inverted index."""
import re
import os
import sys
from pprint import pprint as ppr
from collections import Counter, defaultdict
from pyquery import PyQuery as pq
View advanced_decorators.py
"""
Exploring some ideas around customizable decorators that derive default
values from a config or instance.
"""
from functools import wraps
# Simple customizable decorator.
View descriptor_test.py
from pprint import pprint as ppr
from collections import defaultdict
from datetime import datetime as dt
class Db(object):
def default_obj(self):
return dict(
last_modified=None,