Skip to content

Instantly share code, notes, and snippets.

View simplynail's full-sized avatar

Pawel Cwiek simplynail

  • Warsaw (PL)
View GitHub Profile
@simplynail
simplynail / postgresql_changes_tracking.sql
Created December 5, 2018 15:49 — forked from cristianp6/postgresql_changes_tracking.sql
Log row changes in PostgreSQL - Any advice/improvement is welcome ;-)
/**
* Creates a "logging" schema with an "history" table where are stored records in JSON format
*
* Requires PostgreSQL >= 9.3 since data is stored in JSON format
*
* Credits: http://www.cybertec.at/2013/12/tracking-changes-in-postgresql/
*/
/* Create a schema dedicated to logs */
CREATE SCHEMA logging;
@simplynail
simplynail / graph.py
Created December 27, 2016 20:55
Python plotting using Tkinter
import Tkinter
class GraphException(Exception):
def __init__(self, string):
Exception.__init__(self, string)
class Graph(Tkinter.Canvas):
def __init__(self, master, **options):
Tkinter.Canvas.__init__(self, master, **options)
if 'width' in options and 'height' in options:
@simplynail
simplynail / data_model2kivy.py
Created March 3, 2016 14:16 — forked from jsexauer/data_model2kivy.py
Kivy Data Model Bridge -- A set of classes to allow the effortless bridging of of a data model written in standard python and a UI which is meant to automatically update to display the results of the data model
"""
Allow the simple creation of kivy UIs for arbitrary python object. The UI
will automatically update as the underlying python model changes, provided any
function on the UI side that changes the underlying data model use the
"update" decorator.
"""
import kivy
kivy.require('1.7.0')
@simplynail
simplynail / html.py
Last active September 9, 2015 12:13 — forked from kstep/html.py
Simple Python HTML template DSL
__all__ = []
def export(value):
__all__.append(value.__name__)
return value
import sys
module = sys.modules[__name__]
class Context(object):
@simplynail
simplynail / ptml.py
Last active September 9, 2015 12:13 — forked from kstep/ptml.py
Simple Python HTML template DSL (improved Python 3 version)
#
# Python Template Markup Language
# Simple Python DSL for HTML and (a little) CSS templating.
#
# Example:
#
# from ptml import *
#
# with html5 as out:
# with head: