Skip to content

Instantly share code, notes, and snippets.

View Stiivi's full-sized avatar

Stefan Urbanek Stiivi

View GitHub Profile
@Stiivi
Stiivi / gist:1205736
Created September 9, 2011 08:11
Brewery leak
import brewery.streams
import brewery.nodes
import time
class FunctionSubstituteNode(brewery.nodes.Node):
"""Manipulate a field using a function.
This is a simpler version of DeriveNode(); a single field is passed in
rather than the entire record.
"""
@Stiivi
Stiivi / gist:1388739
Created November 23, 2011 14:05
Brewery server app w. backbone
$(function(){ /* jQuery.ready */
var Stream = Backbone.Model.extend({
initialize: function() { /* do nothing */ },
});
window.streamsCollection = Backbone.Collection.extend({
model: Stream,
url: "http://localhost:5000/streams",
@Stiivi
Stiivi / gist:2024372
Created March 12, 2012 20:07
Markdown Twitter Bootstrap column layout syntax proposal

!-- layout 4 4 4

First

This is first column

  • foo
  • bar
@Stiivi
Stiivi / example.json
Created March 14, 2012 20:20
Brewery runner tool - basic stream example
{
"label": "Basic Data Audit",
"description": "Provides basic data statistics, such as completeness",
"nodes" : {
"src": {
"type": "csv_source",
"resource": "https://raw.github.com/Stiivi/cubes/master/examples/hello_world/data.csv"
},
"audit": {
@Stiivi
Stiivi / generator_function_example.py
Created March 20, 2012 18:37
Generator Function Source Node in Brewery
"""
Data Brewery - http://databrewery.org
Example: How to use a generator function as a streaming data source.
"""
import brewery
import random
@Stiivi
Stiivi / brewery_example-aggregate.py
Created April 3, 2012 20:32
Data Brewery - Aggregate a Remote CSV File
"""
Data Brewery Example
Aggregate a remote CSV file.
"""
import brewery
main = brewery.create_builder()
main.csv_source("https://raw.github.com/Stiivi/cubes/master/examples/hello_world/data.csv")
@Stiivi
Stiivi / data_brewery-basic_audit_example.py
Created April 4, 2012 13:12
Data Brewery - basic audit of "unknown" CSV file
"""
Brewery Example - basic audit of "unknown" CSV file.
Shows:
* record count
* null count and ratio
* number of distinct values
"""
@Stiivi
Stiivi / gist:2360650
Created April 11, 2012 17:16
Jaj bože muj, jaj bože muj, co ja narobila
Jaj bože muj, jaj bože muj, co ja narobila.
Do jakoho, do jakoho ja śe zaľubila.
Do takoho, dotakoho pijaka lajdaka
co viplatu i zalohu prepije preflaka.
Vi dzvičatka, vi dzivčatka, na mne śe kajajce,
za pijakov, za lajdakov śe ňe vidavajce.
Bo s pijakom, bo s lajdakom zažijece križu,
prepije vam, prepije vam perinu i chižu.
@Stiivi
Stiivi / vvo_model.json
Created April 23, 2012 15:47
Cubes Model Example: VVO
{
"name" : "vvo",
"locale":"en",
"cubes": {
"contracts" : {
"name": "contracts",
"measures": {
"zmluva_hodnota": {"label": "Contract amount"}
},
"details": [
from sqlalchemy import *
from sqlalchemy import sql
def create_table(url, schema=None):
engine = create_engine(url)
metadata = MetaData(engine, reflect=True)
table = Table("test_table", metadata, schema=schema)
if table.exists():
table.drop()