Skip to content

Instantly share code, notes, and snippets.

View dbrkv's full-sized avatar
☣️
Blue cheese has mold in it

Dmitry dbrkv

☣️
Blue cheese has mold in it
View GitHub Profile
@dextervip
dextervip / PostgreSqlPlatform.php
Last active April 25, 2024 10:54
Symfony Doctrine support for timescaledb
<?php
namespace App\Domain\Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform as PostgreSqlPlatformBase;
class PostgreSqlPlatform extends PostgreSqlPlatformBase
{
@holmberd
holmberd / php-pools.md
Last active November 13, 2025 10:56
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@BrainlabsDigital
BrainlabsDigital / Campaign Budget Overspend Monitoring
Last active October 29, 2022 12:13
Labels (and optionally pauses) campaigns that are overspending too much, and emails you a warning.
/**
*
* Campaign Budget Overspend Monitoring
*
* This script labels campaigns whose spend today is more than their daily
* budgets. Optionally, it also pauses campaigns whose spend exceeds the
* budget by too much. An email is then sent, listing the newly labelled
* and paused campaigns.
* When spend no longer exceeds budget, the campaigns are reactivated and
* labels are removed.
@whatsmate
whatsmate / group-send-telegram-text.gs
Last active June 29, 2022 00:32
Sending a text message to a Telegram Group in Google Apps Script
function main() {
var group_name = "Muscle Men Club"; // TODO: Specify the name of your group
var group_admin = "12025550108"; // TODO: Specify the number of the group admin
var message = "Your six-pack is on the way!";
sendTelegramGroupText(destNumber, message);
}
function sendTelegramGroupText(group_name, group_admin, message) {
var instanceId = "YOUR_INSTANCE_ID_HERE"; // TODO: Replace it with your gateway instance ID here
@Yaoshicn
Yaoshicn / install-erlang-on-raspberry-pi-3.md
Last active April 26, 2019 22:52
Install Erlang on Raspberry Pi 3

Dependencies

The libwxbase2.8/libqt5/libgtk2.0-dev could be installed for insurance.

# for erlang
sudo apt-get install fop 
sudo apt-get install libncurses5-dev
sudo apt-get install openjdk-6-jdk
sudo apt-get install unixodbc-dev
sudo apt-get install g++
@pobsuwan
pobsuwan / rabbitmq-cluster.md
Last active November 25, 2025 04:45
How to config rabbitmq server cluster [3 nodes]

How to config rabbitmq server cluster [3 nodes]

Edit /etc/hosts

vi /etc/hosts
192.168.10.157  rabbitmq-1
192.168.10.159  rabbitmq-2
192.168.10.161  rabbitmq-3
@bisubus
bisubus / .htaccess
Last active November 4, 2016 06:40
Yii 2 Advanced Application Template on virtual hosting
Options -Indexes
<IfModule !mod_rewrite.c>
Deny from all
</IfModule>
<IfModule mod_rewrite.c>
@Turin86
Turin86 / WSSoapClient.php
Last active April 26, 2026 22:53 — forked from johnkary/WSSoapClient.php
WS-Security for PHP SoapClient
<?php
/**
* This class can add WSSecurity authentication support to SOAP clients
* implemented with the PHP 5 SOAP extension.
*
* It extends the PHP 5 SOAP client support to add the necessary XML tags to
* the SOAP client requests in order to authenticate on behalf of a given
* user with a given password.
*
@nikic
nikic / objects_arrays.md
Last active February 27, 2026 12:16
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@sgmurphy
sgmurphy / url_slug.js
Created July 12, 2012 02:05
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>