Skip to content

Instantly share code, notes, and snippets.

View hartym's full-sized avatar
👽
Crafting great software

Romain Dorgueil hartym

👽
Crafting great software
View GitHub Profile
@hartym
hartym / execute.py
Created March 25, 2017 10:29
Bonobo - Step 4 - Create your graph and execute it
import bonobo
graph = bonobo.Graph(
my_extract,
my_transform,
my_load,
)
if __name__ == '__main__'
bonobo.run(graph)
@hartym
hartym / load.py
Created March 25, 2017 10:27
Bonobo - Step 3 - Load the data
def my_load(s: str):
with open('/tmp/output.txt', 'a+') as f:
f.write(s+'\n')
@hartym
hartym / transform.py
Last active March 25, 2017 10:26
Bonobo - Step 2 - Transform the data
def my_transform(i: int) -> str:
yield str(i)
@hartym
hartym / extract.py
Last active March 25, 2017 10:26
Bonobo - Step 1 - Extract the data
def my_extract():
yield 1
yield 2
yield 3
@hartym
hartym / designer.html
Created August 24, 2014 20:03
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
# Orignal version taken from http://www.djangosnippets.org/snippets/186/
# Original author: udfalkso
# Modified by: Shwagroo Team and Gun.io
import sys
import os
import re
import hotshot, hotshot.stats
import tempfile
import StringIO
python -c 'import random; print(random.randint(pow(10,3),int(2*pow(10,8)/365)))' 'Gare du Nord'
[alias]
co = checkout
ci = commit
br = branch
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
st = status
[color]
branch = auto
diff = auto
interactive = auto
"""Utilities for managing database sessions."""
from __future__ import with_statement
import contextlib
import functools
@contextlib.contextmanager
def temp_session(session_cls, **kwargs):
"""Quick and dirty context manager that provides a temporary Session object
to the nested block. The session is always closed at the end of the block.
@hartym
hartym / git-stash-grep
Created May 3, 2012 09:45 — forked from netshade/gist:1125810
git stash grep (bash)
stashgrep() {
for i in `git stash list | awk -F ':' '{print $1}'`; do
git stash show -p $i | grep -H --label="$i" "$1"
done
}