Skip to content

Instantly share code, notes, and snippets.

View AphonicChaos's full-sized avatar

AphonicChaos AphonicChaos

View GitHub Profile
# usage:
# time python benchmark.py [simple|callback] <number of iterations>
#
# example:
# time python benchmark.py simple 10000
import sys
from os.path import expanduser
from kivy.config import ConfigParser
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
Builder.load_string('''
<ActionBarDummy>
ActionBar:
pos_hint: {'top':1}
ActionView:
[INFO ] Kivy v1.8.0
[INFO ] [Logger ] Record log in /home/thopiekar/.kivy/logs/kivy_14-02-09_9.txt
[INFO ] [Factory ] 157 symbols loaded
[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=Nones
[TRACE ] [Builder ] load file /usr/lib/python2.7/dist-packages/kivy/data/style.kv
[TRACE ] [Parser ] parsing 1191 lines
[TRACE ] [Parser ] got directive <kivy 1.0>
[TRACE ] [Builder ] build rule for <Label>
[TRACE ] [Builder ] build rule for <-Button,-ToggleButton>
[TRACE ] [Builder ] build rule for <BubbleContent>
MODULES=
# resolve paths to needed programs, preferring Python 2 versions
PYTHON="${PYTHON:-$(command -pv python2.7 || command -pv python3.4)}"
PIP="${PIP:-$(
command -pv pip2.7 || command -pv pip2 || command -pv pip3.4 ||
command -pv pip3 || command -pv pip)}"
VENV="${VENV:-$(

This is my recommended path for learning Haskell.

Something to keep in mind: don't sweat the stuff you don't understand immediately. Just keep moving.

Primary course

Installing Haskell

Ubuntu PPA

# in other words, how is this:
PythonService = autoclass('org.renpy.android.PythonService')
activity = PythonService.mService
# different or better than this:
PythonService = autoclass('org.renpy.android.PythonService')
activity = PythonService()
def make_glue(package, glue_h, glue_c):
glue = """
#include "Python.h"
static PyMethodDef nomethods[] = { {NULL, NULL}};
%s
PyMODINIT_FUNC
init%s(){
PyObject* module;
PyObject* __path__;
@AphonicChaos
AphonicChaos / foo.py
Created June 8, 2014 21:02
Making watchdog suck a little less
from watchdog.observers import Observer
# if it looks like an event handler...
def call(obj):
obj.dispatch = obj.__call__
return obj
observer = Observer()
observer.schedule(call(lambda x: print(
from kivy.uix.label import Label
from kivy.app import App
class Foo(App):
def build(self):
return Label(test="This is some text")
if __name__ == '__main__':
Foo().run()
[INFO ] Logger: Record log in /home/aspidites/.kivy/logs/kivy_14-06-08_0.txt
[WARNING ] [Config ] Upgrading configuration in progress.
[WARNING ] [Config ] Older configuration version detected (0 instead of 10)
[INFO ] Kivy v1.8.1-dev
[INFO ] Python: v2.7.7 (default, Jun 3 2014, 01:46:20)
[GCC 4.9.0 20140521 (prerelease)]
[INFO ] Factory: 169 symbols loaded
[INFO ] Image: Providers: img_tex, img_dds, img_pygame, img_pil, img_gif
[INFO ] Text: Provider: pygame
[INFO ] Window: Provider: pygame(['window_egl_rpi'] ignored)