Skip to content

Instantly share code, notes, and snippets.

View wolfv's full-sized avatar
🚀

Wolf Vollprecht wolfv

🚀
View GitHub Profile
@wolfv
wolfv / bgimage-python-gtk3.py
Created August 25, 2012 20:51
Python GTK 3 Pattern Tiling
#!/usr/bin/env python
from gi.repository import Gtk, Gdk
import cairo
def draw_background( widget, context):
surface = cairo.ImageSurface.create_from_png('bg.png')
sp = cairo.SurfacePattern(surface)
@wolfv
wolfv / why.py
Created August 26, 2012 20:24
Gtk Recent Chooser Menu Fail's
#!/usr/bin/env python
from gi.repository import Gtk
class RecentChooserMenu:
def __init__(self):
window = Gtk.Window()
manager = Gtk.RecentManager.get_default()
self.recentchooser = Gtk.RecentChooserMenu.new_for_manager(manager)
@wolfv
wolfv / gist:4110633
Created November 19, 2012 13:28 — forked from igorw/gist:4108347
React v0.2.4 release notes

React v0.2.4 is more awesome

DNS promises

This release has two major improvements. The first one is that react/dns is now using a promise based API. In case you missed it, react/promise is a PHP library for promises. Take a look at the README and familiarize yourself with it, as it will be used by many libs in the react ecosystem, including core.

The previous API was:

 $dns->resolve('igor.io', function ($ip) {
from sqlalchemy_continuum import get_versioning_manager
class VersionBase(object):
"""Base class for SQL Alchemy continuum objects that supports tagging"""
@classmethod
def tag_current_transaction(cls, **kwargs):
"""Add keyword arguments that will be stored as a `TransactionMeta`
entry on next successful commit that includes versioned objects.
"""
from sqlalchemy_continuum import get_versioning_manager, make_versioned, versioning_manager, version_class, transaction_class
from sqlalchemy_continuum.plugins import TransactionMetaPlugin
from silverflask import db
meta_plugin = TransactionMetaPlugin()
make_versioned(plugins=[meta_plugin])
class VersionedMixin(object):
"""Base class for SQL Alchemy continuum objects that supports tagging"""
@wolfv
wolfv / leica_disto_measurement.py
Created January 6, 2017 11:52
Python Script to get measurements from Leica Disto S910 on Linux
#!/usr/bin/env python
# Authors: Wolf Vollprecht, Timon Homberger
#
# This script is able to obtain measurements from a Leica Disto S910
# from the WIFI HotSpot the Leica is creating. Upon pressing "Enter" the script will
# trigger a measurement on the device and obtain the results on the computer.
#
# Basic instructions:
#
@wolfv
wolfv / xblas.hpp
Last active March 30, 2017 00:42
BLAS and LAPACK functions for xtensor
/***************************************************************************
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XBLAS_HPP
#define XBLAS_HPP
@wolfv
wolfv / logsumexp.cc
Created April 16, 2017 23:45 — forked from nbecker/logsumexp.cc
logsumexp.cc
#include <numpy/arrayobject.h>
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "xtensor/xarray.hpp"
#include "xtensor/xtensor.hpp"
#include "xtensor/xcontainer.hpp"
#include "xtensor/xbroadcast.hpp"
//#include "xtensor/xbuilder.hpp"
#include "xtensor/xview.hpp"
#include "xtensor/xeval.hpp"
@wolfv
wolfv / py.cpp
Last active April 17, 2017 17:49
Reducers benchmark vs numpy
#include <numpy/arrayobject.h>
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "xtensor/xarray.hpp"
#include "xtensor/xtensor.hpp"
#include "xtensor/xcontainer.hpp"
#include "xtensor/xbroadcast.hpp"
#include "xtensor/xview.hpp"
#include "xtensor/xeval.hpp"
#include "xtensor/xio.hpp"
@wolfv
wolfv / make_tests.py
Last active April 18, 2017 04:26
Snippet to generate tests from numpy for xtensor
import numpy as np
dtype_map = {
'bool': 'bool',
'float32': 'float',
'float64': 'double',
'int32': 'int',
'int64': 'long',
'uint32': 'unsigned int',
'uint64': 'unsigned long',