Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Neuhäuser DasIch

View GitHub Profile
View f4hackingsolver.py
#!/usr/bin/env python3.5
"""
f4hackingsolver
~~~~~~~~~~~~~~~
Solver for the Fallout 4 Hacking Mini Game.
Within Fallout 4 you sometimes encounter terminals that need to be hacked.
When hacking a terminal you are presented with a screen that contains a
list of potential passwords all with the same length.
View bar.py
from nonlocal_ import nonlocal_
def foo():
a = 1
def bar():
nonlocal_('a')
a = 2
bar()
return a
View gist:8745405
import sys
import dis
import inspect
NO_ATTRIBUTE = object()
class SeparateNamedspacedMeta(type):
def __new__(cls, name, bases, attributes):
View gist:5797174
from flask import Flask, url_for
app = Flask(__name__)
@app.route('/', defaults={'page_no': 1})
@app.route('/<int:page_no>')
def main(page_no):
print url_for('main', page_no=2)
return unicode(page_no)
View foo.py
from flask import Flask, stream_with_context, json, Response
app = Flask(__name__)
@app.route('/')
def index():
def gen():
yield json.dumps({'foo': 'spam'})
yield json.dumps({'bar': 'eggs'})
View gist:5731007
[program:apostle]
directory=/var/www/
command=/var/www/env/bin/gunicorn apostle
user=www-data
autostart=True
autorestart=True
redirect_stderr=True
View app.py
from flask import Flask
from package.db import db
app = Flask(__name__)
db.init_app(app)
@DasIch
DasIch / example.py
Created May 12, 2013
__prepare__ for Python 2.x
View example.py
from __future__ import print_function
from collections import OrderedDict
from prepareable import Prepareable
from six import with_metaclass, iteritems
class FooMeta(with_metaclass(Prepareable, type)):
def __new__(cls, name, bases, attributes):
View gist:5492983
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def index():
return "<br>".join("%s = %r" % item for item in request.args.items())
View gist:5333211
# coding: utf-8
"""
pythonic.tests.test_checkers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2013 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst for more details
"""
import os