Skip to content

Instantly share code, notes, and snippets.

@udovicic
udovicic / ocp.php
Created February 1, 2024 07:20 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@udovicic
udovicic / di.xml
Created September 14, 2023 11:29
Magento 2 maintenance IPs when site is behind proxy
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- ... -->
<!-- Inside di.xml, place the following -->
<!-- Restore original visitor IP from CloudFlare header -->
<type name="Magento\Framework\HTTP\PhpEnvironment\RemoteAddress">
<arguments>
<argument name="alternativeHeaders" xsi:type="array">
<item name="http_cf_connecting_ip" xsi:type="string">HTTP_CF_CONNECTING_IP</item>
@udovicic
udovicic / setup-oci8.sh
Created December 27, 2021 09:59
OCI8 installation on ubuntu Ubuntu 18.04.5 LTS running PHP 7.4 from ondrej PPA
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Download the Oracle Instant Client and SDK from Oracle website
mkdir /opt/oracle
cd /opt/oracle/
#!/bin/bash
function get_project_handle ()
{
local project_handle=${PWD##*/};
echo ${project_handle}
}
if ! grep -q "www.$(get_project_handle).loc" /etc/hosts; then
@udovicic
udovicic / INSTRUCTIONS.md
Last active January 6, 2021 19:16
Instructions for setting up Magento 2 code analysis with PHPSTorm

Setting up MEQP Coding standard checks in PHPStorm

Overview

In order to submit extensions to Magento marketplace, source code needs to pass Magento Extension Quality Program Coding Standard checks.

You can either do it manually, by following this guide in official Github repository, or by fixing things as you code, by setting up check in PHP Storm.

Install and configure Code Sniffer on system

@udovicic
udovicic / temperature.py
Last active September 5, 2016 18:48
DHT22 sensors readings using Adafruit Python DHT Sensor Library
#!/usr/bin/python
# Requires Adafruit Python DHT Sensor Library
# https://github.com/adafruit/Adafruit_Python_DHT
# [email protected]:adafruit/Adafruit_Python_DHT.git
# Measures temperature 5 times, and sends average to thingspeak.
# First measurement is discarded.
# It is intended to be executed by cron in background
@udovicic
udovicic / checker.php
Created June 16, 2016 08:46
SSL checker
<?php
/**
* Code is taken from: https://raw.githubusercontent.com/zencart/zencart/v160/extras/curltester.php
* Just put it in the web root and execute. Evertything must be marked as 'GOOD', otherwise you will have problems...
*
*
* Standalone Diagnostics/Debug tool for testing CURL communications to common 3rd party services such as USPS and PayPal and Authorize.net and more.
* Accepted parameters:
* d=1 or details=1 -- show CURL connection details -- useful for determining cause of communications problems
* r=1 -- show Response obtained from destination server -- this may contain an error message, but usually means communication was okay

Preparing local environment for Magento development

This guide is based on Linux mint, Ubuntu based linux distribution. You can download it from here. It will help you setup apache environment in your home folder.

Packgae installation

You will need to install several things. First of them is Apache itself. From terminal run:

sudo apt-get install apache2
@udovicic
udovicic / InventoryUpdate.php
Created October 31, 2015 11:17
SOAP v2 Inventory update example
<?php
/**
* Magento catalogInventoryStockItemUpdate API example Using SOAPv2
*
* Local measurements:
* Login time: 1.3139259815216s
* Total execution time: 34.751662969589s
*/
/**
@udovicic
udovicic / table_cleaning.sql
Created September 27, 2015 10:50
Magento extra table flush
SET foreign_key_checks = 0;
TRUNCATE `core_cache_option`;
TRUNCATE `core_cache_tag`;
TRUNCATE `core_session`;
TRUNCATE `dataflow_batch_export`;
TRUNCATE `dataflow_batch_import`;
TRUNCATE `enterprise_logging_event`;
TRUNCATE `enterprise_logging_event_changes`;
TRUNCATE `enterprise_support_backup`;
TRUNCATE `enterprise_support_backup_item`;