Skip to content

Instantly share code, notes, and snippets.

View tzonghao's full-sized avatar

Tzong Hao Chen tzonghao

View GitHub Profile
@danni
danni / fields.py
Created March 8, 2016 08:52
Multi Choice Django Array Field
from django import forms
from django.contrib.postgres.fields import ArrayField
class ChoiceArrayField(ArrayField):
"""
A field that allows us to store an array of choices.
Uses Django 1.9's postgres ArrayField
and a MultipleChoiceField for its formfield.

This is in response to https://peadarcoyle.wordpress.com/2016/03/02/a-map-of-the-pydata-stack/ . It started off as an e-mail but I decided to keep things public.

First, let me just say that I think that reproducing the ML decision graph is a really cool idea. I suspect that it'll get hairy for a while as people speak up. I'll speak up below, but I'm obviously invested in some of these projects, so you should probably take everything I say with a grain of salt. OK, here we go:

To me scientific data overlaps with tabular and array. It's not clear that the choice between {array, dataframe, scientific} is easy to make "Well, I have scientific array data, what do I choose now?"

The same issue exists somewhat for time-series "Well, I have tabular time series, which branch do I take?" I recommend removing Castra from the map, it's not a very serious project.

I can envision a separate map for storage technologies (hdf5, netcdf, bcolz, castra, csv, parquet, ...) It's odd to have both computational system

@oroce
oroce / nginx.conf
Created January 31, 2014 20:40
nginx config for using grafana, elasticsearch and graphite with authentication.
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
@ttscoff
ttscoff / Marker.js
Created December 22, 2013 05:19
Bookmarklet for Markdownifying webpage selections
// Marker, a bookmarklet for Markdownifying webpage selections
// javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/8078727/raw/Marker.js?x="+(Math.random());})();
(function () {
function callback() {
(function ($) {
var raw, userSelection;
if (window.getSelection) {
// W3C Ranges
userSelection = window.getSelection ();
// Get the range:
@ttscoff
ttscoff / Bullseye.bookmarklet
Last active August 30, 2023 06:46
A bookmarklet for grabbing just a piece of a web page and converting it to Markdown using heckyesmarkdown.com.
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://cdn.rawgit.com/ttscoff/6109434/raw/Bullseye.js?x="+(Math.random());})();
@ttscoff
ttscoff / grab links.bookmarklet
Last active April 3, 2024 19:44
Create a bookmark and paste the code from `grab links.bookmarklet` into the url. Trigger it on a page containing links you want to save and then click the section of the page containing the links. A Markdown list of all links will be generated, and clicking the resulting list will select all for copying.
@hrldcpr
hrldcpr / tree.md
Last active April 26, 2024 08:53
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@mbostock
mbostock / .block
Last active March 25, 2024 16:38 — forked from jasondavies/flare.json
Automatic Text Sizing
height: 760
license: gpl-3.0