Skip to content

Instantly share code, notes, and snippets.

View maweki's full-sized avatar

Mario Wenzel maweki

View GitHub Profile
from pysat.formula import *
from collections import namedtuple
P = namedtuple('P', ['x', 'y', 'z'])
boxes = {}
depth = 7
width = 3
height = 3
def ELFHash(key):
h = 0
x = 0
for k in key:
h = (h << 4) + ord(k)
x = h & 0xF0000000
if x != 0:
h ^= (x>>24)
h &= ~x
return hex(h & 0x7FFFFFFF)[2:].rjust(8, "0")
from collections.abc import Mapping
from itertools import chain
def _raise(ex):
raise ex
def empty(_ = None):
class __puredict(puredict):
__len__ = lambda _: 0
__getitem__ = lambda _, __: _raise(KeyError())
model = [];
delete_node = function(node, m) {
if (m === undefined) { m = model; }
for (var i = 0; i < m.length; i++) {
if (m[i] == node) {
m.splice(i, 1);
break;
}
else {
import numpy as np
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas
from gi.repository import Gtk
import time
from gi.repository import GObject
class MyWindow(Gtk.ApplicationWindow):
def __init__(self):
@maweki
maweki / ECS.hs
Created December 22, 2014 22:40
ECS.hs
{-# language GeneralizedNewtypeDeriving #-}
import qualified OBDD as O
import OBDD(OBDD)
import qualified Data.Array as A
import qualified Data.Set as S
import qualified Data.Maybe as M
import System.Environment
@maweki
maweki / ECS.hs
Created December 22, 2014 22:36
ECS.hs
{-# language GeneralizedNewtypeDeriving #-}
import qualified OBDD as O
import OBDD(OBDD)
import qualified Data.Array as A
import qualified Data.Set as S
import qualified Data.Maybe as M
import System.Environment
@maweki
maweki / ECS.hs
Created December 21, 2014 10:19
Canonical Repr
-- Is canonical representation with regards to renaming
canonical_renaming :: Idx -> (Word, Word) -> OBDD Var
canonical_renaming (Idx sigma) (l,r) = if (sigma > 2) then (crn (Idx 0) (l++r)) else (head (head l))
crn :: Idx -> Word -> OBDD Var
crn (Idx prog) w = case w of
[] -> O.constant True
l:ls -> ((O.or (take (prog) l)) O.&& (crn (Idx prog) ls))
O.|| ((l !! (min (prog)(length l - 1))) O.&& (crn (Idx (prog+1)) ls))
# -*- mode: python -*-
#
# jhbuildrc for building gnome-shell. Customizations shuld be done in
# ~/.jhbuildrc-custom
#
# Copyright (C) 2008 Red Hat, Inc.
#
# Some ideas and a bit of code taken from gtk-osx-build
#
# Copyright (C) 2006, 2007, 2008 Imendio AB
@maweki
maweki / trapez.c
Last active December 26, 2015 05:49
Trapez.c
#include <stdio.h>
#include "mpi.h"
/* Funktion, welche integriert wird */
double f(double x)
{
return 4/(1.0+x*x);
}