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 / user_notification_email.html
Created August 29, 2025 15:17
OpenPanel emial notificataions template
<div class="">
<div class="aHl"></div>
<div id=":mg" tabindex="-1"></div>
<div
id=":pi"
class="ii gt"
jslog="20277; u014N:xr6bB; 1:WyIjdGhyZWFkLWY6MTgxMzc5NjU4MTEzOTAwNTM2NiJd; 4:WyIjbXNnLWY6MTgxMzc5NjU4MTEzOTAwNTM2NiIsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLG51bGwsbnVsbCxudWxsLDBd"
>
<div id=":ph" class="a3s aiL msg-5951896855460130215">
<u></u>

OpenPanel

OpenPanel is a lightweight, modular web-hosting control panel designed for developers, resellers, and hosting providers. It offers powerful features with a modern interface and high performance.

Key Features

  • Multi-User Management
  • User isolation
@stefanpejcic
stefanpejcic / export_openpanel_mysql.sh
Created August 10, 2025 11:42
Export OpenPanel mysql database tables
#!/bin/bash
mysql --database=panel -e "SHOW TABLES;" -s --skip-column-names | \
while read table; do
echo "Dumping $table"
echo "SHOW CREATE TABLE \`$table\`;" >> panel_full_dump.sql
mysql --database=panel -e "SHOW CREATE TABLE \`$table\`\G" | \
grep -v '^\*\*\*' >> panel_full_dump.sql
mysql --database=panel -e "SELECT * FROM \`$table\`;" --skip-column-names | \
awk -v tbl="$table" 'BEGIN {print "INSERT INTO `" tbl "` VALUES"} \
{printf "("; for(i=1; i<=NF; i++) { printf "\"%s\"", $i; if(i<NF) printf ","; } print "),"} END {print ";"}' >> panel_full_dump.sql
@stefanpejcic
stefanpejcic / custom.css
Last active August 8, 2025 11:37
custom css example for OpenPanel ui
.dark\:bg-gray-950:where(.dark,.dark *){background-color:black!important}
.rounded-lg, .rounded-xl, .rounded-md, .rounded-l {
border-radius: 0;
}
.-left-4 {
display:none;
}
@stefanpejcic
stefanpejcic / varnish.php
Created July 10, 2025 16:03
WordPress Must-use plugin for HTTPS behind Varnish Proxy
<?php
/**
* Plugin Name: HTTPS for wp-admin
* Description: Forces SSL for wp-admin via X-Forwarded-Proto.
*
* https://wpxss.com/wp-config-php/how-to-set-up-wordpress-behind-a-secure-reverse-proxy-using-nginx/
*/
add_action('muplugins_loaded', function () {
if ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
# prepration
git clone https://github.com/cathugger/mkp224o.git
apt install gcc libc6-dev libsodium-dev make autoconf
cd mkp224o
./autogen.sh
./configure
make
# generation
#!/bin/bash
log_dir="/var/lib/docker/containers"
echo "Container Name | Log Size"
echo "--------------------------"
for log_file in "$log_dir"/*/*-json.log; do
container_id=$(basename "$(dirname "$log_file")")
@stefanpejcic
stefanpejcic / demo_mode_openpanel.sh
Created April 25, 2025 18:28
Properly enable demo mode for OpenPanel
# enable demo
opencli config update demo_mode on
# disaable dev
opencli config update dev_mode off
# purge all redis cache so dev_mode value is instantly active and any sensitive data removed
docker exec -it openpanel_redis redis-cli FLUSHALL
@stefanpejcic
stefanpejcic / msmtp
Created April 14, 2025 13:16
openpanel /etc/msmtp specific email address
account openpanel
host 1IP_HERE
port 465
from stefan@openpanel.com
user stefan@openpanel.com
password XXXXXXXXXXXXXXXXXXXX
auth login
tls off
tls_starttls off
tls_trust_file /etc/ssl/certs/ca-certificates.crt
@stefanpejcic
stefanpejcic / msmtprc
Created April 14, 2025 13:15
/etc/msmtprc for openpanel user
# /etc/msmtprc
defaults
auth off
tls off
logfile /var/log/msmtp.log
account default
host IP_HERE
port 25
from USERNAME@HOSTNAME