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 camel_to_snake(data: str) -> str: | |
data = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', data) | |
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', data).lower() | |
def snake_to_pascal(data: str) -> str: | |
return ''.join[word.title() for word in data.split('_')] |
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
# range is inclusive | |
# replaces the entire line of the match (uncommenting in the case of newly provisioned servers) | |
NEW_PORT=$(shuf -i 3101-7999 -n 1) | |
sudo sed -i "/Port 22/c Port $NEW_PORT" /etc/ssh/sshd_config && sudo systemctl restart sshd && echo "SSH Port has been changed to $NEW_PORT" |
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
global: | |
scrape_interval: 5s | |
external_labels: | |
monitor: 'node' | |
scrape_configs: | |
- job_name: 'prometheus' | |
static_configs: | |
- targets: [':9090'] ## IP Address of the localhost. Match the port to your container port | |
- job_name: 'node-exporter' | |
static_configs: |
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
from datetime import datetime, timedelta | |
from flask import current_app, make_response, render_template | |
from app.models import Post | |
@app.route('/sitemap.xml', methods=['GET']) | |
def sitemap(): | |
'''Generate sitemap.xml iterating over static and dynamic routes to make a list of urls and date modified''' | |
pages = [] | |
ten_days_ago = datetime.now - timedelta(days=10) |
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="container"> | |
<div class="row"> | |
<div class="col-sm-6"> | |
<div class="form-group"> | |
<div class="input-group date" id="datetimepicker1" data-target-input="nearest"> | |
<input type="text" name="date" id="datetimepicker1" class="form-control datetimepicker-input" data-target="#datetimepicker1"/> | |
<div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker"> | |
<div class="input-group-text"><i class="fa fa-calendar"></i></div> | |
</div> | |
</div> |