Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am moschlar on github.
  • I am moschlar (https://keybase.io/moschlar) on keybase.
  • I have a public key whose fingerprint is 19F9 B5A8 821A 081E FE92 D306 45D3 DBDD FBDD 8888

To claim this, I am signing this object:

@moschlar
moschlar / awesomepythonpackages.md
Last active December 23, 2015 09:39
Collection of awesome Python packages. Just a personal notepad.
  • Arrow: better dates and times for Python
  • ftfy: fixes text for you
  • colors.py: Colors aren't that scary!
  • ordereddict: No need to include the ActiveState recipe anymore
  • argh: An unobtrusive argparse wrapper with natural syntax
  • billiard: Python multiprocessing fork with improvements and bugfixes
  • Unidecode: ASCII transliterations of Unicode text
  • anyjson: Wraps the best available JSON implementation available in a common interface
@moschlar
moschlar / timer.py
Created June 2, 2013 12:53
Python execution timing context manager class
import time
class Timer(object):
def __init__(self, echo=False):
self._start = 0.0
self._stop = 0.0
self.echo = echo
def __enter__(self):
self._start = time.time()
def add_error_middleware(self, global_conf, app):
"""Add middleware which handles errors and exceptions."""
from pylons.middleware import report_libs, StatusCodeRedirect
from tg.error import ErrorHandler
#from raven import Client
#from raven.middleware import Sentry as WSGISentry
#app = WSGISentry(app, Client(config.get('sentry.dsn')))
from raven.contrib.pylons import Sentry as PylonsSentry
app = PylonsSentry(app, config)
@moschlar
moschlar / movie.py
Last active December 12, 2015 04:28
Customize sprox dropdown menus
class Genre(DeclarativeBase):
__tablename__ = "genres"
genre_id = Column(Integer, primary_key=True)
name = Column(String(100))
description = Column(String(200))
@property
def _name(self):
return '%s (%s)' % (self.name, self.description)
main = putStrLn "Hello, World!"
@moschlar
moschlar / resume.c
Created January 9, 2013 23:18 — forked from klange/_.md
#include <stdio.h>
#include <time.h>
/* TODO: resume.h */
typedef struct {
char * company;
char * location;
char * title;
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils latex-package
# All acroread related stuff is gracefully stolen from app-text/acroread/acroread-9.5.1-r1.ebuild
ACROREAD_LICENSE="Adobe"
import os
import tw2.core as twc
import tw2.forms as twf
ace_js = twc.JSLink(
modname=__name__,
filename='static/ace/ace.js',
edit=twc.js_function('ace.edit'),
require=twc.js_function('ace.require'),
@moschlar
moschlar / edit.html
Created December 7, 2012 22:45
Generated HTML
<script type="text/javascript">ace.require("ace/ext/textarea").transformTextarea(document.getElementById("source")).getSession().setMode("ace/mode/java")</script>
<script type="text/javascript">ace.require("ace/ext/textarea").transformTextarea(document.getElementById("source")).getSession().setMode("ace/mode/java").getSession().setMode("ace/mode/java")</script>