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 );
@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 September 7, 2024 17:49
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 October 26, 2024 00:11
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 November 13, 2024 14:47
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 July 10, 2024 14:10
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=""
@diegopacheco
diegopacheco / npm-nvm-nodejs-linux-debian-jessie.md
Created January 26, 2018 16:35
How to install NodeJs, NPM and NVM on Linux Debian 8 - Jessie
sudo apt-get update -y
sudo apt-get install build-essential libssl-dev -y
curl -sL https://deb.nodesource.com/setup_9.x| bash -
apt-get install -y nodejs
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
nvm install 9.4.0
nvm use 9.4.0
@xianx
xianx / backup
Last active March 3, 2018 00:04
RSync
sudo rsync -vrazh --progress [email protected]:/backup/ /ebs/containers/percona-tdba-d/backup