Skip to content

Instantly share code, notes, and snippets.

@edelbluth
edelbluth / simple_trie.py
Created Oct 23, 2016
Code Sample for juergen.rocks
View simple_trie.py
root_node = None
class TrieNode(object):
def __init__(self):
self.__children = {}
self.__result = None
def __add(self, word: str, rest: str) -> None:
View mathe.py
def addiere(*args):
"""
Die Methode »addieren« soll 2-5 Summanden annehmen und deren Summe zurückliefern.
>>> addiere(1, 2)
3
>>> addiere(1, 2, 3)
6
View sfnet2github.sh

Licence (MIT Licence)

Copyright (c) 2011 Simon Walker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@edelbluth
edelbluth / nested.py
Last active Aug 29, 2015
juergen.rocks > Python-Klassen-Initialisierung: Bemerkenswertes Verhalten
View nested.py
# -*- coding: utf-8 -*-
# Copyright 2015 Juergen Edelbluth
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@edelbluth
edelbluth / cherrypy-tpl.py
Last active Aug 29, 2015
Mount a CherryPy Application with additional header security
View cherrypy-tpl.py
"""
References:
[LUH] https://www.owasp.org/index.php/List_of_useful_HTTP_headers
[XFO] https://www.owasp.org/index.php/Clickjacking_Defense_Cheat_Sheet
[CSP] https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#Bonus_Rule_.232:_Implement_Content_Security_Policy
"""
_csp_sources = ['default', 'script', 'style', 'img', 'connect', 'font', 'object', 'media', 'frame']
_csp_default_source = "'self'"