Skip to content

Instantly share code, notes, and snippets.

View emiliodallatorre's full-sized avatar

Emilio Dalla Torre emiliodallatorre

View GitHub Profile
@emiliodallatorre
emiliodallatorre / do_backup.sh
Created March 10, 2025 23:42
Backup a WordPress server with TAR and WP CLI
#!/bin/bash
# Configuration
WEBSITE_PATH="/var/www/jeitaly.org"
BACKUP_DIR="$HOME/backup"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_FOLDER="$BACKUP_DIR/$TIMESTAMP"
DB_DUMP_FILE="jeitaly_db_$TIMESTAMP.sql"
WEBSITE_ARCHIVE="jeitaly_website_$TIMESTAMP.tar.gz"
@emiliodallatorre
emiliodallatorre / docker-compose.yml
Created July 2, 2024 12:13
WordPress and MySQL in Docker Compose
version: "4.0"
services:
# MySQL Database
database:
image: mysql:latest
volumes:
- database_data:/var/lib/mysql
restart: always
environment:
CREATE DATABASE wordpress;
CREATE USER wordpress@localhost IDENTIFIED BY '<your-password>';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;
FLUSH PRIVILEGES;
quit
# Create VM istance and log into it
multipass launch --name jetop-wordpress
multipass shell jetop-wordpress
# Update packages
sudo apt update && sudo apt upgrade -y
# Install nginx and net-tools
sudo apt install nginx net-tools
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:geoflutterfire2/geoflutterfire2.dart';
class LocationHelper {
static Map<String, dynamic> geoFirePointToJson(final GeoFirePoint? geoFirePoint) {
return geoFirePoint?.data;
}
static GeoFirePoint? geoFirePointFromJson(final Map<String, dynamic>? json) {
if (json == null) {
@emiliodallatorre
emiliodallatorre / key_properties_extractor.py
Created August 22, 2023 09:03
Simple script to extract key.properties from a list of Flutter project directories
from os import walk
from os.path import exists
directories: list = walk(".")
key_properties_files: dict = {}
for directory in directories:
# Check if it is a flutter project
if "pubspec.yaml" in directory[2]:
# Check if key.properties exists
#!/bin/bash
rm -rf wp-includes
rm -rf wp-admin
wp core download --skip-content --force --allow-root
wp plugin install $(wp plugin list --field=name --allow-root) --force --allow-root
wp theme install $(wp theme list --field=name --allow-root) --force --allow-root
find wp-content/uploads -name "*.php" -delete
@emiliodallatorre
emiliodallatorre / httpd.conf
Last active November 10, 2022 21:07
Configurazione per Climax di HTTPD
# Server per il debug di Climax
LoadModule php_module /usr/local/lib/httpd/modules/libphp.so
<VirtualHost *:8080>
# TODO: Sostituire con il percorso alla cartella del progetto nel proprio computer
DocumentRoot /Users/emiliodallatorre/Documents/GitHub/climax-webapp-php
ErrorLog /Users/emiliodallatorre/Documents/GitHub/climax-webapp-php/error.log
CustomLog /Users/emiliodallatorre/Documents/GitHub/climax-webapp-php/access.log combined
Options Indexes FollowSymLinks Multiviews Indexes
@emiliodallatorre
emiliodallatorre / find_route_without_context.dart
Created August 25, 2022 19:33
Find current route without context
// https://stackoverflow.com/questions/46483949/how-to-get-current-route-path-in-flutter
String? currentPath;
navigatorKey.currentState?.popUntil((Route<dynamic> route) {
currentPath = route.settings.name;
return true;
});
@emiliodallatorre
emiliodallatorre / default.conf
Last active June 7, 2022 19:00
Empty Nginx web server configuration
# server {
# listen 80;
# server_name yourhostname.it www.yourhostname.it;
# return 301 https://yourhostname.it$request_uri;
# }
server {
# listen 443 ssl; # managed by Certbot
# ssl_certificate /etc/letsencrypt/live/yourhostname.it/fullchain.pem; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/yourhostname.it/privkey.pem; # managed by Certbot