Skip to content

Instantly share code, notes, and snippets.

View Bujhm's full-sized avatar
🐢
I may be slow to respond.

Igor Bujhm

🐢
I may be slow to respond.
View GitHub Profile
@Bujhm
Bujhm / rabbitmq_cheatsheet_ru.md
Created February 11, 2024 21:17 — forked from kyptov/rabbitmq_cheatsheet_ru.md
RabbitMQ Cheat Sheet (russian)

Общие упрощенные понятия. Возможно существуют способы задать другое поведение нежели данное упощенное.

Понятия

  • producer - отправитель, программный код, который отправляет сообщение.
  • consumer - получатель, программный код, который должен получить сообшение.
  • exchange - обменник, функционал RabbitMQ, получает сообщение с заданными параметрами от отправителя и:
    • может сбросить(удалить) сообщение или вернуть отправителю (зависит от атрибутов сообщения),
    • может отправить сообщение в очередь,
    • может отправить сообщение в несколько очередей (сообщение будет скопировано для каждой очереди)
  • queue - очередь, функционал RabbitMQ, хранит все сообщения и раздает их получателям.
  • message - сообщение, содержит атрибуты необходимые RabbitMQ, а также данные для передачи от отправителя к получателю
@Bujhm
Bujhm / security_vulnerable_php_code.php
Created January 25, 2024 02:37
security vulnerable php code (old)
<?php
// Code with the security issue
// Connect to the database
$mysqli = new mysqli ("localhost", "username", "password", "database");
// Check for errors
if ($mysqli->connect_error) {
die("Connection failed: ". $mysqli->connect_error);}
// Get the user input from a GET request
$user_id = $_GET['user_id'];
@Bujhm
Bujhm / multipleSSHkeysForUnix.md
Created December 10, 2023 20:43 — forked from bonnopc/multipleSSHkeysForUnix.md
Enable Multiple SSH Keys for MacOS/ Ubuntu/ Debian etc.

Enable Multiple SSH Keys for UNIX Based OS

Follow these steps below to enable multiple SSH keys on your device with UNIX Based OS (MacOS/ Ubuntu/ Debian etc.). Suppose, you have two different users/ accounts, one is personalAccount and another is companyAccount. And you have already a default key configured with personalAccount. (If you haven't set up your default ssh-key yet, please follow this article before going ahead with these steps described below.)

1. Generate another ssh-key

Generate a new ssh-key for your companyAccount.

cd ~/.ssh
ssh-keygen -t rsa -C "your_email@youremail.com"
@Bujhm
Bujhm / gist:07fe150547dccbf2ad7259e88318e8e7
Created December 10, 2023 20:42 — forked from patsbin/gist:868c48c5e8b3de1ccad7dd19257f7a17
Keychain Error: Problem adding; giving up
Getting an error after migrating to a new system when adding private keys to ssh-agent
/usr/bin/keychain -q --nogui $HOME/.ssh/id_rsa.key
* Error: Problem adding; giving up
Manually adding the key shows a permission problem
ssh-add ~/.ssh/id_rsa.key
chmod 700 /home/pwi/.ssh/*.key
In .bashrc
@Bujhm
Bujhm / dockerCheatSheet.md
Created October 15, 2023 15:09 — forked from Marak/dockerCheatSheet.md
docker cheat sheet

Things I wish I knew before I started using Docker

Commands

Init docker on mac os

boot2docker init

Restart docker vm on mac os

boot2docker up
@Bujhm
Bujhm / MockEntityManager.php
Created February 18, 2022 19:24 — forked from Taluu/MockEntityManager.php
Mock some services for PHPUnit
<?php
namespace Traits\Tests;
/**
* Mocks the entity manager
*
* Provides everything in the memory, so the tests does not depend on doctrine,
* which does a lot of stuff (maybe too much). This also allows to avoid to
* need and modify the data in the database, even if those are for the tests.
@Bujhm
Bujhm / Exporter.php
Created May 31, 2021 14:17 — forked from kunicmarko20/Exporter.php
Custom sonata admin export
<?php
/**
* Created by PhpStorm.
* User: markokunic
* Date: 4/21/17
* Time: 3:41 PM
*/
namespace AppBundle\Exporter;
@Bujhm
Bujhm / Dockerfile
Created May 14, 2021 11:34 — forked from VisualBean/Dockerfile
post alpine update
FROM node:8.15-alpine
RUN apk --no-cache add git
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
@Bujhm
Bujhm / gist:caad33c354aa58ae9ce5bfd9f6d64676
Created November 4, 2020 08:20 — forked from timonweb/gist:3165322
Code to catch all PHP errors which result in 500 Error Code. Include this snippet at the beginning of index.php file
<?php
define('E_FATAL', E_ERROR | E_USER_ERROR | E_PARSE | E_CORE_ERROR |
E_COMPILE_ERROR | E_RECOVERABLE_ERROR);
define('ENV', 'dev');
//Custom error handling vars
define('DISPLAY_ERRORS', TRUE);
define('ERROR_REPORTING', E_ALL | E_STRICT);
@Bujhm
Bujhm / gist:e60dc15f125c309f0983cb581905b046
Created September 17, 2020 00:42 — forked from nostah/gist:d610459d50564c729c56
php swagger 2.0 api sample
<?php
use Swagger\Annotations as SWG;
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},