Skip to content

Instantly share code, notes, and snippets.

View Stiivi's full-sized avatar

Stefan Urbanek Stiivi

View GitHub Profile
@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 / 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()
@Stiivi
Stiivi / os_to_cubes.py
Created May 28, 2012 22:37
OpenSpending model to Cubes model conversion
from sqlalchemy import create_engine, MetaData, Table
import json
OS_DATASET = "de-bund"
def get_os_metadata(dataset_name):
engine = create_engine("postgres://postgres@localhost/openspending")
md = MetaData(bind=engine)
table = Table("dataset", md, autoload=True)
@Stiivi
Stiivi / slicer.ini
Created May 28, 2012 22:38
OpenSpending/Cubes test Slicer Configuration
[server]
debug=yes
log_level=debug
reload=yes
backend = sql.star
prettyprint = true
[workspace]
url = postgres://postgres@localhost/openspending
@Stiivi
Stiivi / date_model_example.json
Created June 12, 2012 22:56
Cubes: Mapping of date parts in date datatype columns
{
"cubes": [
{
"name": "example",
"measures": ["amount"],
"dimensions": ["date"],
"mappings": {
"date.year": {"column":"date", "extract":"year"},
"date.month": {"column":"date", "extract":"month"},
"date.day": {"column":"date", "extract":"day"}