Skip to content

Instantly share code, notes, and snippets.

@Makman2
Makman2 / dbus-error-11-3-2016-20-20.txt
Last active March 11, 2016 19:22
dbus-error-11-3-2016-20-20
mak@localhost:~/dev/coala (master) +1 ~0 -0 $ py.test
Test session starts (platform: linux, Python 3.4.3, pytest 2.8.7, pytest-sugar 0.5.1)
rootdir: /home/mak/dev/coala, inifile: setup.cfg
plugins: timeout-1.0.0, sugar-0.5.1, xdist-1.14, doc-0.0.1, env-0.6.0, cov-2.2.1
docs/index.rst ⚫ 0%
docs/General_Dev_Info/git_tutorial_1.rst ⚫ 0% ▏
docs/Getting_Involved/Codestyle.rst ⚫ 1% ▏
docs/Getting_Involved/MAC_Hints.rst ⚫ 1% ▏
docs/Getting_Involved/Newcomers.rst ⚫ 1% ▏
mak@localhost:~/dev/coala (master) +1 ~0 -0 $ py.test
Test session starts (platform: linux, Python 3.4.3, pytest 2.8.7, pytest-sugar 0.5.1)
rootdir: /home/mak/dev/coala, inifile: setup.cfg
plugins: timeout-1.0.0, sugar-0.5.1, xdist-1.14, doc-0.0.1, env-0.6.0, cov-2.2.1
docs/index.rst ⚫ 0%
docs/General_Dev_Info/git_tutorial_1.rst ⚫ 0% ▏
docs/Getting_Involved/Codestyle.rst ⚫ 1% ▏
docs/Getting_Involved/MAC_Hints.rst ⚫ 1% ▏
docs/Getting_Involved/Newcomers.rst ⚫ 1% ▏
@Makman2
Makman2 / BearSetting.py
Created February 28, 2016 23:29
Prototype that shall replace get_metadata() more or less inside Bear
# TODO Don't think I need this, but maybe we switch to a simpler system instead
# TODO of grabbing function metadata. So idea is grab metadata but parse them
# TODO into these BearSetting's for easier use.
class BearSetting:
@enforce_signature
def __init__(self, name: str, typ: type, default=None):
if default is not None and type(default) is not typ:
raise ValueError("Default is not of given type.")
self._name = name
from multiprocessing import Pool
if __name__ == "__main__":
# Initialize pool workers already
#
# Instantiate bears (params: the section and list of files that contains proxy objects serving the file as a string, presplitted lines and the file name, maybe other parameters)
#
# The file proxy objects contains lazy functions! So memory is only reserved on need
# for specific stuff. For that purposes maybe one can create a
# "MultiRepresentationObject" class that needs one specific "representation" of an
@Makman2
Makman2 / ce3d2-example.cpp
Created January 10, 2016 01:02
First test program for CE3D2!
#include <CE3D2/render/TextSurface.h>
#include <iostream>
#include <string>
using TextSurface = CE3D2::Render::TextSurface;
void print_surface(TextSurface const& surf)
{
std::string border = "--";
for (TextSurface::size_type x = 0; x < surf.width(); x++)
from timeit import *
def conditional_check(a, b):
if a is None or b is None:
return 10
else:
return 24
def tuple_check(a, b):
@Makman2
Makman2 / absolute_position_to_line_column.py
Created October 17, 2015 22:56
Converts absolute text position to line/column position
def _absolute_position_to_line_column(string, pos):
"""
Converts an absolute char-position to a line-column position.
:param string: The string where the position is associated to.
:param pos: The position to convert (starts from 0).
:returns: A pair with (line, column). Line and column start with 1.
"""
line = string.count("\n", 0, pos) + 1
column = string.rfind("\n", 0, pos)
@Makman2
Makman2 / InterruptableProcessTest.py
Created October 9, 2015 21:54
Test for InterruptableProcess
import unittest
from multiprocessing import Event
from InterruptableProcess import InterruptableProcess
class InterruptableProcessTest(unittest.TestCase):
def test_normal_run(self):
def worker(e1, e2, e3):
e1.wait()
@Makman2
Makman2 / InterruptableThread.py
Last active October 9, 2015 21:53
WIP-Prototype for InterruptableThread
# Prototype for an InterruptableProcess.
# 8.10.2015 --> Makman2
import ctypes
import multiprocessing
import threading
def _wait_for_single(*events):
"""
Waits for at least one event being set.
@Makman2
Makman2 / satellizer-oauth-fail
Created October 5, 2015 15:38
satellizer-oauth-fail
^Cmak@localhost:~/dev/gitmate-satellizer (master)$ ./runserver.sh
* Running on http://127.0.0.1:3000/
* Restarting with reloader
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET /stylesheets/angular-toastr.css HTTP/1.1" 304 -
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET /stylesheets/styles.css HTTP/1.1" 304 -
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET /vendor/angular.js HTTP/1.1" 304 -
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET /vendor/angular-animate.js HTTP/1.1" 304 -
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET /vendor/angular-messages.js HTTP/1.1" 304 -
127.0.0.1 - - [05/Oct/2015 17:36:48] "GET /vendor/angular-resource.js HTTP/1.1" 304 -