Skip to content

Instantly share code, notes, and snippets.

View gnanet's full-sized avatar

Gergely Nagy gnanet

  • Self-Employed Freelancer
  • Hungary
  • X @gnanet
View GitHub Profile
@webdevs-pro
webdevs-pro / page-update.php
Created October 3, 2021 18:02
Elementor data widget controls updater
<?php
function update_controls( $elements ) {
$new_elements = array();
foreach ( $elements as $element_index => $element ) {
foreach ( $element as $key => $value ) {
if ( $key == 'elements' && ! empty( $value ) ) {
$new_elements[$element_index][$key] = update_controls( $value );
@rsitze
rsitze / gitr
Last active January 13, 2025 13:18
Find nearest (in commit history) related branch(es) given a base branch. See https://stackoverflow.com/a/68673744/1448212
#!/usr/local/bin/bash
# For a walk through of what this does, how it works,
# see: https://stackoverflow.com/a/68673744/1448212
# git show-branch supports 29 branches; reserve 1 for current branch
GIT_SHOW_BRANCH_MAX=28
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
@ychaouche
ychaouche / Spamassassin rules description
Last active April 12, 2025 20:58
Spamassassin rules description
1 AC_BR_BONANZA Too many newlines in a row... spammy template
2 ACCESSDB Message would have been caught by accessdb
3 ACCT_PHISHING_MANY Phishing for account information
4 AC_DIV_BONANZA Too many divs in a row... spammy template
5 AC_FROM_MANY_DOTS Multiple periods in From user name
6 AC_HTML_NONSENSE_TAGS Many consecutive multi-letter HTML tags, likely nonsense/spam
7 AC_POST_EXTRAS Suspicious URL
8 AC_SPAMMY_URI_PATTERNS10 link combos match highly spammy template
9 AC_SPAMMY_URI_PATTERNS11 link combos match highly spammy template
10 AC_SPAMMY_URI_PATTERNS12 link combos match highly spammy template
@scr34m
scr34m / dns_dotroll.sh
Last active June 9, 2023 07:29
Acme.sh DNS API interface for Dotroll
#!/usr/bin/bash
# Dotroll domain api
# - api access values stored per domain, including migration from account stored values
# - zone data is POST-ed to avoid "414 Request-URI Too Large" errors
#
# Initially export values Dotroll_User and Dotroll_Password
# export Dotroll_User='<your.dotroll@user>'; export Dotroll_Password='<dotroll_api_password>'; acme.sh --issue --dns dns_dotroll -d <domain.tld> -d '*.<domain.tld>'
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
@dsferruzza
dsferruzza / README.md
Last active September 30, 2024 02:32
Configure a memory_limit for scheduled tasks of a Laravel app on Clever Cloud

Problems

  • some of my Laravel's scheduled tasks fail because the default memory_limit of PHP is too low
  • running php -d memory_limit=xxx artisan schedule:run does not seem to have any effect
  • there is no way to provide a custom php.ini for CLI-only on Clever Cloud

Solution

This patch adds a simple way to set memory_limit using a CLI_MEMORY_LIMIT environment variable. This new setting only applies when the Laravel app is booted from CLI (like when running php artisan ... commands) and have no effect on the memory_limit value in web context.

@JuanDMeGon
JuanDMeGon / Kernel.php
Last active April 2, 2025 13:35
A small Laravel command to collect the sessions garbage if applicable to the current session driver
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
//...
@sergeyklay
sergeyklay / journalctl-cheatsheet.md
Last active April 8, 2025 04:54
Journalctl Cheat Sheet

Journalctl Cheat Sheet

Configuration

Permissions

To see messages from other users and the system as well as performing various log operations from a regular user add it to the group:

sudo usermod -aG systemd-journal $USER
@BenSampo
BenSampo / deploy.sh
Last active April 2, 2025 09:01
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@RichardBronosky
RichardBronosky / README.md
Last active February 24, 2025 04:59
Using cloud-init for cloudless provisioning of Raspberry Pi

Installing cloud-init on a fresh Raspbian Lite image

This is a work in Progress!

Purpose

This mainly demonstrates my goal of preparing a Raspberry Pi to be provisioned prior to its first boot. To do this I have chosen to use the same cloud-init that is the standard for provisioning servers at Amazon EC2, Microsoft Azure, OpenStack, etc.

I found this to be quite challenging because there is little information available for using cloud-init without a cloud. So, this project also servers as a demonstration for anyone on any version of Linux who may want to install from source, and/or use without a cloud. If you fall into that later group, you probably just want to read the code. It's bash so everything I do, you could also do at the command line. (Even the for loop.)

@hyunto
hyunto / backup_rsync.sh
Created January 30, 2018 07:28
backup data using rsync
#!/bin/bash
set -e
DATE="`date +%Y%m%d_%H%M%S`"
TYPE=""
SRC_DIR=""
DEST_DIR=""
BACKUP_DIR=""