Skip to content

Instantly share code, notes, and snippets.

View mbr's full-sized avatar

Marc Brinkmann mbr

View GitHub Profile
error[E0271]: type mismatch resolving `<fn() -> ! {std::process::abort} as core::ops::FnOnce<()>>::Output == T`
--> /home/marc/.cargo/registry/src/github.com-1ecc6299db9ec823/safe_unwrap-0.3.0/src/lib.rs:130:14
|
130 | self.unwrap_or_else(std::process::abort)
| ^^^^^^^^^^^^^^ expected !, found type parameter
|
= note: expected type `!`
found type `T`
error: aborting due to previous error
@mbr
mbr / simplelogbook.py
Last active August 29, 2015 14:19
Example taken from the logbook docs, not working as of 0.9.0.
# from https://pythonhosted.org/Logbook/api/handlers.html#logbook.Handler
#
# > By default messages sent to that handler will not go to a handler on an
# > outer level on the stack, if handled. This can be changed by setting
# > bubbling to True. This setup for example would not have any effect:
# >
# > handler = NullHandler(bubble=True)
# > handler.push_application()
# >
# > Whereas this setup disables all logging for the application:
@mbr
mbr / app.py
Last active August 29, 2015 13:57
from flask import Flask, render_template
from flask_wtf import Form
from wtforms import TextField, PasswordField, BooleanField
from wtforms.validators import Required, EqualTo, Email, Length
from flask_bootstrap import Bootstrap
class UserForm(Form):
username = TextField('Username', [Required()])
password = PasswordField('Password',
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# coding=utf8
from binascii import hexlify
import os
from passlib.hash import bcrypt
dummy = bcrypt(use_defaults=True)
salt = dummy.salt
@mbr
mbr / test_something.py
Created June 8, 2012 18:13
Parametric tests in python
#!/usr/bin/env python
# coding=utf8
# before, in virtualenv:
# pip install testscenarios testtools
# (unfortunately, testscenarios doesn't list testtools as a dependency)
# "real code"
class Backend(object):
pass
# compare: http://packages.python.org/Logbook/api/handlers.html
$ python logbook-test.py
$ python logbook-test2.py
$ python logbook-test3.py
$ python logbook-test4.py
[2012-03-14 12:45] INFO: Generic: Hello, world
@mbr
mbr / brokenmat.py
Created February 10, 2011 15:50
weird behavior with findMaterial
#!/usr/bin/env python
# coding=utf8
# for output, see https://gist.github.com/820741
import direct.directbase.DirectStart
from panda3d.core import MaterialCollection
model = loader.loadModel('testmodel.egg')
find_terms = ('playerColorA', 'playerColorB', 'nonsense', '')
DirectStart: Starting the game.
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
all materials
Material playerColorB a(0.152049 0.8 0.183424 1) d(0.152049 0.8 0.183424 1) s(0.25 0.25 0.25 1) s12.5 l0 t0
Material playerColorA a(0.8 0.126309 0.388125 1) d(0.8 0.126309 0.388125 1) s(0.25 0.25 0.25 1) s12.5 l0 t0