Skip to content

Instantly share code, notes, and snippets.

View matpratta's full-sized avatar

Matheus Pratta matpratta

View GitHub Profile
@matpratta
matpratta / coolify-migrate.sh
Created June 15, 2024 03:05 — forked from Geczy/migrate.sh
Migrate Coolify to a new server
#!/bin/bash
# This script will backup your Coolify instance and move everything to a new server. Docker volumes, Coolify database, and ssh keys
# 1. Script must run on the source server
# 2. Have all the containers running that you want to migrate
# Configuration - Modify as needed
sshKeyPath="$HOME/.ssh/your_private_key" # Key to destination server
destinationHost="server.example.com"
@matpratta
matpratta / du-seamless-animated-images.rs.lua
Last active August 8, 2023 16:53
🖥️ DU Render Script: Seamless Animated Images
-- Demo settings, fill them in with the data from your sprite sheet:
-- - Image: the uploaded link to the image
-- - Cols: number of columns on your sheet
-- - Rows: number of rows on your sheet
-- - FPS: desired frame rate for the animation
-- - Skip: how many frames are missing at end of sheet, used for seamless loops
local image = 'assets.prod.novaquark.com/113304/503a53c7-3fc0-418e-bb59-97e2dfcf1b8d.jpg'
local cols = 19
local rows = 12
@matpratta
matpratta / du-global-dump.lua
Created September 1, 2022 16:03 — forked from d-lua-stuff/dump.lua
Global variable dumping script for Dual Universe. See https://board.dualthegame.com/index.php?/topic/20052-lua-all-global-variables/ for more info. License: WTFPL
local max = math.max
local concat, insert = table.concat, table.insert
local byte, gsub, format, match, rep = string.byte, string.gsub, string.format, string.match, string.rep
local buffer = { "Lua globals dump: \r\n\r\n" }
local should_get_function_params = true
local should_dump_functions = false
local table_visited = {}
@matpratta
matpratta / espruino-serial-mixed-mode.js
Created June 4, 2022 03:34
Small Espruino thingy that allows for bidirectional serial communication while also detecting Espruino IDE for development
// Start init
console.log('Preparing JS environment...');
console.log('Booting I2c...');
I2C1.setup({scl:NodeMCU.D1, sda:NodeMCU.D2});
// Command object
var COMMANDS = {};
// Response
@matpratta
matpratta / se-analog-basic-control.cs
Created February 20, 2022 22:54
🚀 Compiled SE AnalogThrottle sample script
/*
* R e a d m e
* -----------
*
* In this file you can include any instructions or other comments you want to have injected onto the
* top of your final script. You can safely delete this file if you do not want any such comments.
*/
// List of valid axis types
private readonly string[] AXIS_TYPES = new string[] { "Normal", "Center", "Reverse" };
@matpratta
matpratta / slimplicity.omp.json
Created September 6, 2021 20:13
🎨 Slimplicity, a modded "slim" theme for PowerShell & oh-my-posh
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": true,
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{if .Root}}root :: {{end}}{{.Shell}} :: {{.Folder}}",
"blocks": [
{
"type": "prompt",
"alignment": "left",
@matpratta
matpratta / fn.flatten_redirect_chain.php
Created August 17, 2020 17:48
🔗 Follows a redirect chain path and either redirects to the final URL or returns it
/**
* fn.flatten_redirect_chain.php
* Follows a redirect chain path and either redirects to the final URL or returns it
* Author: Matheus Pratta <github.com/matheusmk3>
* License: 0BSD
* Version: 1.0.0
*
* @param string $destination The URL that is part of a redirect chain and shall be resolved
* @param mixed $redirect The redirect type to be used (301/302) or false for returning the final URL as string
*
@matpratta
matpratta / cron-fix-wordpress-upload-permissions.sh
Last active April 1, 2020 21:15
🔧 Fixes WordPress upload directories permissions being set to root, use it with crontab.
#!/bin/bash
# Set this to your server's owner user (normally www-data)
user="www-data:www-data"
# Set this to the path to your wp-content
wp_content_path="/var/www/html/wp-content"
# Gets current year and month numbers
year=`date +%Y`
@matpratta
matpratta / fix.wp-mysql8-onlyfullgroupby.php
Last active October 24, 2019 18:59
🔧 Fixes errors regarding ONLY_FULL_GROUP_BY when using WordPress with managed database services using MySQL 8.
<?php
/*
Plugin Name: WP Managed MySQL 8 Fix
Plugin URI: https://gist.github.com/MatheusMK3/4f3acb29ac4fb0e9a03318bcacec1972
Description: Fixes issues regarding MySQL modes (ONLY_FULL_GROUP_BY) when on managed database services.
Author: Matheus Pratta
Version: 1.0.0
Author URI: https://matheus.io
*/