Skip to content

Instantly share code, notes, and snippets.

<?php
use function Flow\Azure\SDK\DSL\azure_blob_service;
use function Flow\Azure\SDK\DSL\azure_blob_service_config;
use function Flow\Azure\SDK\DSL\azure_shared_key_authorization_factory;
use function Flow\Filesystem\Bridge\Azure\DSL\azure_filesystem;
use function Flow\Filesystem\Bridge\Azure\DSL\azure_filesystem_options;
use function Flow\Filesystem\DSL\fstab;
use function Flow\Filesystem\DSL\path;
use function Flow\Filesystem\DSL\protocol;
<?php
$adapter = new PSRSimpleCache(
new Psr16Cache(new FilesystemAdapter(defaultLifetime: 3600, directory: __DIR__ . '/cache'))
);
data_frame(config_builder()->cache($adapter))
->read(
from_cache(
id: 'ga_account_summaries',
@norberttech
norberttech / benchmark.php
Last active November 7, 2023 17:37
Parquet vs Json - PHP Benchmark
<?php
use Flow\Parquet\Reader;
use JsonMachine\Items;
use JsonMachine\JsonDecoder\ExtJsonDecoder;
include __DIR__ . '/vendor/autoload.php';
$jsonStream = \fopen(__DIR__ . '/dataset.json', 'r');
@norberttech
norberttech / changelog-release.yml
Last active January 18, 2021 23:23
Aeon Automation - Workflows
name: "Changelog - Release Unreleased"
###################################################################
# WARNING - THIS ACTION WILL PUSH COMMIT DIRECTLY INTO REPOSITORY #
###################################################################
on:
push:
tags:
- '*'
@norberttech
norberttech / psql.tf
Last active December 16, 2020 19:55
PostgreSQL, Terraform - Grant SELECT to a ROLE for single database table in given schema
## Make sure that on the host machine that executes terraform apply there is a psql client available in $PATH
resource "postgresql_role" "user" {
name = "some-user"
login = false
skip_reassign_owned = true
depends_on = [data.azurerm_postgresql_server.server]
}
@norberttech
norberttech / php-pools.md
Created April 5, 2020 05:42 — forked from holmberd/php-pools.md
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
@norberttech
norberttech / 11_02_2020_report
Last active February 11, 2020 20:29
MBP Pro 16" Wakeup with 2 external monitors connected through usb-c
panic(cpu 4 caller 0xffffff7f8179dad5): userspace watchdog timeout: no successful checkins from com.apple.WindowServer in 120 seconds
service: com.apple.logd, total successful checkins since load (31910 seconds ago): 3192, last successful checkin: 0 seconds ago
service: com.apple.WindowServer, total successful checkins since load (31880 seconds ago): 3176, last successful checkin: 120 seconds ago
Backtrace (CPU 4), Frame : Return Address
0xffffffa773d23820 : 0xffffff8000d3bb2b
0xffffffa773d23870 : 0xffffff8000e734d5
0xffffffa773d238b0 : 0xffffff8000e64f4e
0xffffffa773d23900 : 0xffffff8000ce2a40
0xffffffa773d23920 : 0xffffff8000d3b217
@norberttech
norberttech / pd_google_chat_connector.json
Created September 16, 2019 21:43
Azure Logic Apps connector that translates PagerDuty extension requests into Google Chat expected webhooks
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Condition": {
"actions": {
"HTTP": {
"inputs": {
@norberttech
norberttech / 01-intro.md
Last active September 14, 2019 18:56
Is it a bug in php 7.2.22?

I think there might be something wrong with memory leaks detection in php 7.2.x, this gist describes how I ran into this problem.

Recently I migrated https://github.com/norzechowicz/php-uamqp extension into Github Actions CI/CD. This extension brings uamqp 1.0 protocol into php (probably useless for most people but I work on Azure that works only on amqp 1.0) On gitub I have 3 actions, each for different php version. Action flow is simple:

  • Checkout source code
  • Installing required software
node('rundeck-cli') {
withCredentials([string(credentialsId: 'rundeck-token', variable: 'RD_TOKEN')]) {
stage('Get list of rundeck projects') {
try {
def projects = sh(returnStdout: true, script: 'rd projects list --outformat "%name"').toString().trim()
projects.split().each {
sh script: 'rd executions deletebulk -y -m ${RD_OPTION_BATCH:-20} --older ${RD_OPTION_OLDER_THAN:-7d} -p ' + it
}