Skip to content

Instantly share code, notes, and snippets.

1.
// Michael Neumann und Moritz Schlarb
2.
//
3.
// Programmiersprachen, SoSe 2010
4.
// Übung zur Vorlesung vom 19.04.2010
5.
//
@moschlar
moschlar / gl.py
Created December 11, 2011 12:50
Travelling Salesman Problem visualized with pyopengl
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 09.12.2011
@author: moschlar
'''
from OpenGL.GL import *
from OpenGL.GLUT import *
@moschlar
moschlar / pstatvfs.c
Created January 30, 2012 13:55
struct statvfs print function
#include <stdio.h>
#include <sys/statvfs.h>
void pstatvfs(struct statvfs *stat) {
printf("struct statvfs {\n");
printf("\tf_bsize = %lu\n", stat->f_bsize);
printf("\tf_frsize = %lu\n", stat->f_frsize);
printf("\tf_blocks = %d\n", (int) stat->f_blocks);
@moschlar
moschlar / fsusage.c
Created January 30, 2012 18:00
get filesystem usage under linux
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/statvfs.h>
#include "pstatvfs.h"
#define ARGLEN 255
int main (int argc, char* argv[]) {
@moschlar
moschlar / JSSortableTableBase.py
Created May 12, 2012 12:37
JSSortableTableBase
tablesorter_js = JSLink(link=url('/jquery.tablesorter.js'),
javascript=[jquery_js])
class JSSortableTableBase(TableBase):
'''A TableBase that uses the jquery plugin tablesorter for table sorting'''
# javascript = [tablesorter_js]
# css_classes = ['tablesorter']
# Any additional arguments to tablesorter, see http://tablesorter.com/docs/#Configuration
# -*- coding: utf-8 -*-
'''
Created on 17.03.2012
Ported to tw2 on 25.05.2012
@author: moschlar
'''
import tw2.core as twc
import tw2.forms as twf
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils bash-completion-r1
DESCRIPTION="Git extensions to provide high-level repository operations for Vincent Driessen's branching model."
HOMEPAGE="https://github.com/nvie/gitflow"
# -*- coding: utf-8 -*-
'''
Created on 17.03.2012
Ported to tw2 on 25.05.2012
@author: moschlar
'''
import tw2.core as twc
import tw2.forms as twf
@moschlar
moschlar / submission.py
Created May 30, 2012 16:59
A ToscaWidgets2 widget that needs a dynamic SelectField and does work :)
# -*- coding: utf-8 -*-
'''
Created on 17.03.2012
@author: moschlar
'''
import tw2.core as twc
import tw2.forms as twf
import tw2.bootstrap as twb
@moschlar
moschlar / widgets.py
Created June 5, 2012 13:44
ToscaWidgets 2 Bootstrap - CalendarDateTimePicker
class CalendarDateTimePicker(Bootstrap, twc.CompoundWidget):
resources = set(CalendarDatePicker.resources + CalendarTimePicker.resources)
date = CalendarDatePicker()
time = CalendarTimePicker()
def _validate(self, value, state=None):
"""
Inner validation method; this is called by validate and should not be
called directly. Overriding this method in widgets is discouraged; a
custom validator should be coded instead. However, in some