Skip to content

Instantly share code, notes, and snippets.

View DasIch's full-sized avatar

Daniel Neuhäuser DasIch

View GitHub Profile
#!/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.
from nonlocal_ import nonlocal_
def foo():
a = 1
def bar():
nonlocal_('a')
a = 2
bar()
return a
import sys
import dis
import inspect
NO_ATTRIBUTE = object()
class SeparateNamedspacedMeta(type):
def __new__(cls, name, bases, attributes):
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)
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'})
[program:apostle]
directory=/var/www/
command=/var/www/env/bin/gunicorn apostle
user=www-data
autostart=True
autorestart=True
redirect_stderr=True
from flask import Flask
from package.db import db
app = Flask(__name__)
db.init_app(app)
@DasIch
DasIch / example.py
Created May 12, 2013 06:20
__prepare__ for Python 2.x
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):
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def index():
return "<br>".join("%s = %r" % item for item in request.args.items())
# coding: utf-8
"""
pythonic.tests.test_checkers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2013 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst for more details
"""
import os