Skip to content

Instantly share code, notes, and snippets.

View osbre's full-sized avatar
🇺🇦
#StandWithUkraine

Ostap Brehin osbre

🇺🇦
#StandWithUkraine
View GitHub Profile
@themsaid
themsaid / AppServiceProvider.php
Created January 26, 2020 16:24
Re-encryption after APP_KEY rotation
<?php
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
@EngKhaledB
EngKhaledB / Fix Slow NGINX PHP on WSL.md
Last active December 12, 2023 15:30
If you have slow NGINX PHP-FPM performance on Windows Subsytem for Linux (WSL) .. here is the Solution!

1- Locate nginx.conf on your server, which almost on this path /etc/nginx/nginx.conf

2- Add this code under the http block fastcgi_buffering off;

Refrence: microsoft/WSL#2100 (comment)

@rubenvanassche
rubenvanassche / tests.yml
Last active September 23, 2024 12:08
A simple Laravel testing workflow for GitHub Actions
name: Tests (PHP)
on: [push]
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
@Baldinof
Baldinof / .dockerignore
Last active June 28, 2025 21:10
Single PHP FPM container with Caddy
/vendor
/docker
/Dockerfile
@dotherightthing
dotherightthing / Post-meta-vs-separate-database-tables.md
Last active April 17, 2025 03:17
[Post meta vs separate database tables] #database #wordpress

Post meta vs separate database tables

An interesting read from Post meta vs separate database tables

If your plugin is going to have A LOT of data, then using the wp_postmeta is NOT a good idea as demonstrated below:

Taking Woocommerce as an example,

In a store with ~30,000 products, say there will be an average of ~40 post meta (attributes and everything) per product, 5 product images per product, which means there will be ~4 image meta for each image:

@osbre
osbre / AppServiceProvider.php
Created September 7, 2019 16:08
Laravel notifications - how to use custom type
<?php
namespace App\Providers;
use App\Notifications\DatabaseChannel as CustomDatabaseChannel;
use Illuminate\Notifications\Channels\DatabaseChannel;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
@zdenekdrahos
zdenekdrahos / README.md
Last active March 9, 2025 05:48
Docker volumes - www-data Debian/Ubuntu + Alpine

Docker volumes - www-data Debian/Ubuntu + Alpine

Sharing host OS www-data directories as a volume is tricky for Alpine images. User ID (UID) and Group ID (GID) are different.

UID/GID Ubuntu Alpine
33 www-data xfs
82 - www-data
@jessarcher
jessarcher / dslr-webcam.md
Last active December 21, 2025 15:27
Using my Canon 70D DSLR camera as a web cam on Linux

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: https://github.com/umlaeute/v4l2loopback (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using https://github.com/danielkza/v4l2loopback-fedora/)
  2. gPhoto2 - this is what allows you to access your cameras live feed over USB - this was available in Fedora's repos.
  3. GStreamer or ffmpeg - this is what lets you stream the output from gPhoto2 into the loopback device.

It's been a little while since I set it all up so I can't remember all of the installation details, which will probably be different for your distro anyway unless you're using Fedora. Apologies if I have forgotten something as wel.

Running the stream

<?php
namespace App\Observers;
use Illuminate\Database\Eloquent\Model;
class RedirectObserver
{
const REDIRECTS = [
\Modules\Shop\Entities\Product::class => [
@jaredculp
jaredculp / README.md
Last active December 3, 2025 09:51
Void Linux

Void Linux Macbook Air 2013

Flash installer:

$ dd if=void-live-x86_64-musl-20181111.iso of=/dev/X bs=1m

login as root:voidlinux

Base Install: