Skip to content

Instantly share code, notes, and snippets.

@jrast
jrast / client.py
Created February 16, 2022 13:17
Python OPC-UA Dummy Server + Client
import asyncio
from asyncua import Client, Node
import logging
logging.basicConfig(level=logging.WARN, format="%(asctime)s %(message)s")
_logger = logging.getLogger("dummy_client")
_logger.setLevel(level=logging.INFO)
class SubscriptionHandler:
@jrast
jrast / app.js
Last active April 25, 2018 16:38
Vuetify - Buttons and VueRouter
const Foo = { template: '<div>foo</div>' }
const routes = [
{ path: '/foo', component: Foo },
]
const router = new VueRouter({
routes // short for `routes: routes`
})
import time
import matplotlib.pyplot as plt
import numpy as np
from pymba import Vimba
print("Starting Vimba")
vimba = Vimba()
vimba.startup()
@jrast
jrast / cameraCallback.py
Created March 3, 2016 14:50
Async Image grab with pymba and Vimba 1.4, not working
# -*- coding: utf-8 -*-
from pymba import *
import time, Queue
import numpy as np
def frame_cb(frame):
print("Start Callback {} with Frame {}".format(str(frame_cb), str(frame)))
img = np.ndarray(buffer=frame.getBufferByteData(),
@jrast
jrast / howTo.md
Created December 7, 2015 09:48
How To Make WinPython: Overhaul

How to make Winpython-201506 of August 2015

This procedure may help You doing your own Winpython-201506 of August 2015 distribution in about 2 hours. (multiply by 4, if you're taking the slow path)

Changelog

(v08, 2015-08-08):

  • we now use gcc Compiler provided by mingwpy wheel (same author as mingw64-static: Carl Kleffner, much simpler integration: a wheel)
  • we now use a dos batch script instead of runnin make.py interactively
@jrast
jrast / run_test.py
Created July 8, 2014 19:43
Nose2: such and unittest.TestCase
# -*- coding: utf-8 -*-
if __name__ == '__main__':
import logging
import nose2
logging.basicConfig(filename="such.log", level=logging.INFO)
nose2.discover()
@jrast
jrast / conf.py
Last active August 29, 2015 14:01
Acrylamid Intro-Filter Bug
# -*- encoding: utf-8 -*-
# This is your configuration file. Please write valid python!
# See http://posativ.org/acrylamid/conf.py.html
SITENAME = 'demo'
WWW_ROOT = 'http://demo.ch/'
AUTHOR = 'Demo'
EMAIL = '[email protected]'
@jrast
jrast / MultiColumnField.py
Last active August 29, 2015 14:00 — forked from olivergeorge/gist:718687
Django model field which maps a single model field to mutliple db columns
from django.core.exceptions import ValidationError
from django.db.models import Field, CharField
__all__ = ['MultiColumnField']
try:
from hashlib import md5
except ImportError:
from md5 import new as md5
@jrast
jrast / CancelFormAction.php
Created September 14, 2012 13:13
Tutorial: FormActions selbst gebaut
<?php
class CancelFormAction extends FormAction {
private $link;
public function __construct($link = '', $title = '', $form = null, $extraData = null, $extraClass = '') {
if(!$title) $title = _t('CancelFormAction.CANCEL', 'Cancel');
$this->setLink($link);
@jrast
jrast / Calendar.php
Created September 5, 2012 21:19
Passing control down to component
<?php
class Calendar extends Page {
public static $has_many = array(
'Years' => 'Year'
);
}
class Calendar_Controller extends Page_Controller {