Skip to content

Instantly share code, notes, and snippets.

View gnanet's full-sized avatar

Gergely Nagy gnanet

View GitHub Profile
@dimo414
dimo414 / README.md
Created July 23, 2025 06:48
Difference between a standard or --separate-git-checkout repo and a --bare repo

git clone supports several different types of checkouts, notably including --separate-git-dir and --bare. The former works exactly like a vanilla checkout except the .git directory is located elsewhere than directly in the working tree. However --bare creates a different kind of repository, significantly it disables the reflog and changes the default refspec for fetch.

Both of these make --bare a poor choice for a repository you intend to develop against, such as via worktrees. If you just want a "bare" repository directory it is simpler[^1] to:

@djibe
djibe / wsl-windows11.md
Last active August 20, 2026 01:42
Install WSL2 in Windows 11

WSL 2 (Windows Subsystem for Linux v2) for Windows 11 installation

Install WSL components

Check Windows Update is active.

Open Start menu: search for exploit > click on "Exploit protection" result.

Go to Program settings tab. Search for C:\WINDOWS\System32\vmcompute.exe and vmwp.exe.

@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 23, 2026 10:17
Spamassassin rules description
Note:
to keep this list automatically updated,
I turned it into a repo which is automatically updated via cron.
see https://github.com/ychaouche/spamassassin-rules-description
AC_BR_BONANZA Too many newlines in a row... spammy template
ACCESSDB Bericht zou gevangen zijn door accessdb
ACCESSDB Ce message aurait �t� bloqu� par accessdb
ACCESSDB Mensagem teria sido pega pela accessdb
ACCESSDB Message would have been caught by accessdb
@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 August 6, 2026 05:16
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 July 20, 2026 14:50
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