Skip to content

Instantly share code, notes, and snippets.

View pavel-rossinsky's full-sized avatar
🦉

Pavel Rossinsky pavel-rossinsky

🦉
View GitHub Profile
@pavel-rossinsky
pavel-rossinsky / fcgi_debug.php
Last active November 14, 2024 17:49
The PHP script connects to a PHP-FPM service via FastCGI protocol for debugging purposes. It allows you to send a request to PHP-FPM, execute a script, and retrieve the output when other debugging tools are unavailable.
<?php
$url = '/path/to/script.php';
$env = [
'REQUEST_METHOD' => 'GET',
'SCRIPT_FILENAME' => $url,
];
$service_port = 9000;
$address = '127.0.0.1';
@pavel-rossinsky
pavel-rossinsky / clear_sqs_queues.php
Last active November 14, 2024 17:21
PHP script to list and purge all queues in a local ElasticMQ instance running on Docker. It uses Symfony's HttpClient to interact with the service, sending ListQueues and PurgeQueue requests, and outputs the results to the console.
<?php
use Symfony\Component\HttpClient\HttpClient;
require __DIR__ . '/vendor/autoload.php';
$client = HttpClient::create();
$endpoint = 'http://localhost:9424';
try {
@pavel-rossinsky
pavel-rossinsky / generator.php
Created March 2, 2024 16:06 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@pavel-rossinsky
pavel-rossinsky / php speed up tips.html
Created October 17, 2021 21:56 — forked from bsalim/php speed up tips.html
63 Tips for speeding up PHP
<html>
<body>
<p>Here are Webber’s points:</p>
<ul>
<li>If a method can be static, declare it static. Speed improvement is by a factor of 4.</li>
<li>echo is faster than print.(<em>* compare with list from phplens by John Lim</em>)</li>
<li>Use echo’s multiple parameters instead of string concatenation.</li>
<li>Set the maxvalue for your for-loops before and not in the loop.</li>
<li>Unset your variables to free memory, especially large arrays.</li>
<li>Avoid magic like __get, __set, __autoload</li>
@pavel-rossinsky
pavel-rossinsky / gist:b130c1f7b13a9332318d69e185a998d8
Created April 26, 2020 20:09 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@pavel-rossinsky
pavel-rossinsky / gpg_keys.md
Last active April 26, 2020 10:57
Commit Signature Verification. GPG keys.

Managing commit signature verification on Mac. The way to auto sign-commits.

Generating a new GPG key

  1. Check if gpg2 is installed, run which gpg2 if the command outputs nothing, install GPG Keychain.
  2. Using the GPG Keychain utility generate a new key pair.
  3. In the GPG Keychain, export the public key, save it to your documents folder.
  4. Login to your GitHub account and navigate to https://github.com/settings/keys.
  5. Open the exported public key and copy its contents.
  6. Get back to GitHub, press the "New GPG key" button and paste the copied key.
  7. Run git config --global gpg.program gpg2, to make sure git uses gpg2 and not gpg.