This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import sys | |
__log_path = "logile path" | |
__parsed_log_path = "new parsed logfile" | |
__parsed_log_path_only_ip = " " | |
__apiKey = "enter api key for dn-ip here " | |
__api_Url = "http://api.db-ip.com/v2/" # to be added : <apiKey>/<ipAddress> | |
ips = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OBJECTS = {'WALL': '#', | |
'SPACE': ' ', | |
'VISITED': '.', } | |
def readfile(file): | |
try: | |
f = open(file, 'r') | |
except Exception as e: | |
print('Error opening file. Did you enter the correct file-path?') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [1, 5, 2, 5, 3, 5, 5] | |
def quicksort(left, right): | |
if 0 > left: | |
raise ValueError("left border must be greater or equal zero") | |
if right >= len(data): | |
raise ValueError("right index cant be greater than length") | |
if left < right: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def salary(): | |
link = "" | |
key = "" | |
headers = { | |
'Accept': 'application/json' | |
} | |
params = { | |
'api_token': key, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row text-left"> | |
<div class="col-md-4 col-md-offset-4"> | |
<form action="" method="POST" role="form" class="form"> | |
<!--Errors + CSRF--> | |
{{ form.hidden_tag() }} {{ wtf.form_errors(form, hiddens="only") }} | |
{% for field, errors in form.errors.items() %} | |
<div class="alert alert-error"> | |
{{ form[field].label }}: {{ ', '.join(errors) }} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro render_errors(field) %} | |
{% for error in field.errors %} | |
<div class="alert alert-error text-danger"> | |
{{ error }} | |
</div> | |
{% endfor %} | |
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro confirm_deletion(endpoint='#') %} | |
<div id="confirm-deletion"> | |
<button type="button" class="btn btn-danger" data-toggle="modal" | |
data-target="#MyFancyModal">Löschen | |
</button> | |
<div id="MyFancyModal" class="modal fade" role="dialog"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrderableMixin(object): | |
""" Mixin to make database models comparable """ | |
order_index = db.Column(db.Integer, default=_default_index, index=True) | |
@classmethod | |
def normalize(cls): | |
""" Normalize all order indexes """ | |
for idx, item in enumerate(cls.query.order_by(cls.order_index).all()): | |
item.order_index = idx | |
db.session.commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests # install if necessary -> pip install requests | |
URL = 'https://api.noopschallenge.com' + '/hexbot' # change the last part to query different machines | |
r = requests.get(URL) | |
result = r.json() | |
print(result['colors'][0]['value']) # prints the hex code, e.g. #7A5A28 | |
# Additional parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
long factorial(long n) { | |
if (n == 0) | |
return 1; | |
else | |
return (n * factorial(n - 1)); | |
} |
OlderNewer