Skip to content

Instantly share code, notes, and snippets.

View TheRatG's full-sized avatar
🐭
be balanced

Vladimir Pak TheRatG

🐭
be balanced
View GitHub Profile
@TheRatG
TheRatG / mailhog.sh
Created October 24, 2022 05:55
mailhog sevice
#! /bin/sh
# /etc/init.d/mailhog
### BEGIN INIT INFO
# Provides: mailhog
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start MailHog at boot time.
# Description: Enable MailHog.
@TheRatG
TheRatG / dev_mysql.md
Created August 12, 2021 06:00
Dev mysql

Mysqld config

/etc/mysql/mysql.conf.d/mysqld.cnf

skip_log_bin = 1

innodb_buffer_pool_size = 6G
innodb_log_buffer_size = 1G
innodb_log_file_size = 2G
@TheRatG
TheRatG / mailhog.sh
Created April 30, 2021 06:18
Ubuntu18 /etc/init.d/mailhog
#! /bin/sh
# /etc/init.d/mailhog
### BEGIN INIT INFO
# Provides: mailhog
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start MailHog at boot time.
# Description: Enable MailHog.
@TheRatG
TheRatG / TestTidierListener.php
Created August 25, 2020 08:08
Faster PHPUnit
<?php
declare(strict_types=1);
namespace Tests\Core;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementation;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
#https://www.vagrantup.com/docs/synced-folders/nfs.html
```
$enable_serial_logging = false
config.vm.provider "virtualbox" do |v|
v.customize [
"storagectl", :id,
"--name", "SATA Controller",
"--hostiocache", "on"
]
@TheRatG
TheRatG / doctrine_batch.md
Created August 19, 2017 08:55
Doctrine batch insert
// IMPORTANT - Disable the Doctrine SQL Logger
$manager->getConnection()->getConfiguration()->setSQLLogger(null);

while (($data = getData()) {
  $iteration++;

  $obj = new EntityObject();
  $obj->setName('henry');
 // Fill object...
@TheRatG
TheRatG / ngxtop.md
Created July 31, 2017 06:34
Analyse nginx log
@TheRatG
TheRatG / symfony_flash.md
Created June 14, 2017 08:53
Render all flash messages in Twig
{% for label, flashes in app.session.flashbag.all %}
    {% for flash in flashes %}
        <div class="alert alert-{{ label }}">
            {{ flash }}
        </div>
    {% endfor %}
{% endfor %}
@TheRatG
TheRatG / cors.nginx.md
Last active August 3, 2020 13:13
How to enable Cross-Origin Requests (CORS) on nginx

Open nginx CORS configuration

Wide open nginx CORS configuration CORS is a W3C working standard that currently has decent (but inconsistent) implementions in Firefox, Chrome and Safari. I use it primarily to test PhoneGap apps in regular browsers instead of testing the code in simulators. PhoneGap apps can skip the usual origin checks via configuration, but running a PhoneGap app takes more setup - which make it harder for designers to work with the app. Running apps in simulators or on actual devices also takes al lot more time that just reloading a browser and this annoys me.

Read up on CORS

@TheRatG
TheRatG / mac_os_tips.md
Last active January 30, 2017 07:34
Mac OS

SSH Broken Pipe fix

Source

To fix it, on your mac do:

emacs (or vim/vi/nano/etc) ~/.ssh/config

And then, write this: