This file contains hidden or 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
#!/bin/bash | |
# adds a custom blacklist to ufw | |
# Check if ipset is installed | |
if ! command -v ipset &> /dev/null | |
then | |
echo "ipset could not be found, installing..." | |
sudo apt-get update && sudo apt-get install -y ipset | |
else |
This file contains hidden or 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
#!/bin/bash | |
### | |
# | |
# install and enable de locale for openpanel | |
# | |
### | |
cd /usr/local/panel && pybabel init -i messages.pot -d translations -l de | |
wget -O /usr/local/panel/translations/de/LC_MESSAGES/messages.po https://raw.githubusercontent.com/stefanpejcic/openpanel-translations/main/de-de/messages.pot |
This file contains hidden or 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 sys | |
from werkzeug.security import generate_password_hash | |
def hash_password(unhashed_password): | |
hashed_password = generate_password_hash(unhashed_password) | |
return hashed_password | |
if __name__ == "__main__": | |
# Check if the correct number of command-line arguments is provided | |
if len(sys.argv) != 2: |
This file contains hidden or 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 os | |
import sys | |
from htmlmin import minify | |
from css_html_js_minify import process_single_html_file | |
def minify_files(input_dir, output_dir): | |
if not os.path.exists(output_dir): | |
os.makedirs(output_dir) | |
for root, dirs, files in os.walk(input_dir): |
This file contains hidden or 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
#!/bin/bash | |
CLOUDFLARE_IPS_V4=$(/usr/bin/curl -s --max-time 10 https://www.cloudflare.com/ips-v4) | |
CLOUDFLARE_IPS_V6=$(/usr/bin/curl -s --max-time 10 https://www.cloudflare.com/ips-v6) | |
if [ -n "$CLOUDFLARE_IPS_V4" ] && [ -n "$CLOUDFLARE_IPS_V6" ]; then | |
/usr/sbin/ufw --force reset | |
/usr/sbin/ufw default allow incoming | |
/usr/sbin/ufw default allow outgoing | |
for IP in $CLOUDFLARE_IPS_V4; do |
This file contains hidden or 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
docker run \ | |
--name {{printf "%q" .Name}} \ | |
{{- with .HostConfig}} | |
{{- if .Privileged}} | |
--privileged \ | |
{{- end}} | |
{{- if .AutoRemove}} | |
--rm \ | |
{{- end}} | |
{{- if .Runtime}} |
This file contains hidden or 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
#!/bin/bash | |
# Stop the Docker service | |
systemctl stop docker.service | |
# Set the target file | |
target_file="/var/lib/docker.fs" | |
# Get available space in the home directory in kilobytes | |
available_space=$(df -k /home | awk 'NR==2 {print $4}') |
This file contains hidden or 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
dd if=/dev/zero of=myfs.ext4 bs=1M count=10240 | |
mkfs.ext4 myfs.ext4 | |
docker inspect -f '{{ .GraphDriver.DataDir }}' <container_id> | |
mount -o loop /path/to/myfs.ext4 /path/to/writable/layer/folder |
This file contains hidden or 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 flask import Flask, session | |
from flask_session import Session | |
app = Flask(__name__) | |
# Configure session type and secret key | |
app.config['SESSION_TYPE'] = 'filesystem' # You can use other options like 'redis' for better performance | |
app.config['SESSION_PERMANENT'] = True # Session lasts until the browser is closed |
This file contains hidden or 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
# Enable standalone mode and disable anonymous FTP | |
listen=YES | |
anonymous_enable=NO | |
# Allow local users to login | |
local_enable=YES | |
# Enable write access for local users | |
write_enable=YES |