Skip to content

Instantly share code, notes, and snippets.

View stefanpejcic's full-sized avatar
:octocat:
Live long and may the source be with you

Stefan Pejcic stefanpejcic

:octocat:
Live long and may the source be with you
View GitHub Profile
@stefanpejcic
stefanpejcic / Docker_mount.sh
Last active October 6, 2023 19:19
Mount 10gb to limit docker container writable layer
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
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
@stefanpejcic
stefanpejcic / vsftpd.conf
Created October 3, 2023 20:25
vsftpd.conf
# 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
server {
listen 80;
server_name fe34fsd.openpanel.co;
location / {
sub_filter 'http://panel.pejcic.rs/ffff' 'http://fe34fsd.openpanel.co';
sub_filter_once off;
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<img id="screenshot" src="/static/placeholder.png" alt="Screenshot">
<script>
function updateScreenshot(domain) {
$.ajax({
type: "GET",
url: "/screenshot/" + domain,
@stefanpejcic
stefanpejcic / gunicorn.config.py
Last active September 29, 2023 07:42
/usr/bin/gunicorn -c /usr/local/panel/gunicorn.config.py app:app
# Gunicorn configuration file
# https://docs.gunicorn.org/en/stable/configure.html#configuration-file
# https://docs.gunicorn.org/en/stable/settings.html
import multiprocessing
from gunicorn.config import Config
# Create a Gunicorn configuration object
config = Config()
@stefanpejcic
stefanpejcic / Check_if_vps_or_dedicated_server.sh
Last active September 20, 2023 05:11
Check if vps or dedicated server
#!/bin/bash
if [[ -e /dev/kvm || -e /dev/qemu || -e /proc/user_beancounters || -e /proc/xen || -e /proc/sys/xen || -e /sys/bus/xen ]]; then
echo "VPS (Virtual Private Server)"
elif [[ -f /.dockerenv || $(grep -sq 'docker\|lxc' /proc/1/cgroup) ]]; then
echo "Docker container"
else
echo "Dedicated server"
fi
@stefanpejcic
stefanpejcic / add_user.sh
Last active September 18, 2023 22:18
Create container and open its ports in csf
#!/bin/bash
# Check if the correct number of command-line arguments is provided
if [ "$#" -ne 4 ]; then
echo "Usage: $0 <username> <password|generate> <email> <plan>"
exit 1
fi
# Get data from command-line arguments
username="$1"
@stefanpejcic
stefanpejcic / entrypoint.sh
Last active September 18, 2023 07:56
Run bunch of stuff on docker start/unpause
#!/bin/bash
echo "Container is starting..."
# Get the current container's IP address
CONTAINER_IP=$(hostname -i)
# Old IP address to be replaced on docker run
OLD_IP=""
# Get the container name
#!/bin/bash
echo "This is your chance now to cancel the update process."
echo "You can hit CTRL-C to abort, otherwise the install starts in a few seconds."
for ((i=1; i<=6; i++))
do
sleep 1
echo -n "."
done
echo "running"