Skip to content

Instantly share code, notes, and snippets.

View standa's full-sized avatar

Standa standa

  • Standa
  • Prague, Czech Republic, Europe
View GitHub Profile
@standa
standa / upgrade-php-to-72.sh
Created January 18, 2018 14:28
Upgrade PHP 7.1 -> 7.2
#!/usr/bin/env bash
# TODO: EXPERIMENTAL run command by command as it will spit errors!
# ERRRORS: php-xdebug not working for php 7.2 yet!
if [ $EUID -ne 0 ]; then
exec sudo $0
fi
systemctl stop apache2
@standa
standa / logs-tee.php
Created January 4, 2018 14:29
Apache gzip logs by domain
<?php
/**
* Process all apache *.log.gz access logs in current directory
* - split data by domain (first field in access log)
*/
if (!is_dir('out')) {
mkdir('out');
}
@standa
standa / ping.php
Last active November 29, 2017 15:11
Error ping
<?php
/**
* @example Run as `php ping.php`
*
* Ping and keep pinging every 5 seconds.
*
* Print out only the errored packets
*/
@standa
standa / php.ini
Created September 21, 2017 12:46
hhvm with proxygen
; DO NOT EDIT THIS FILE - put everything into server.ini
; AND CHECK tailf /var/log/hhvm/error.
; php options
session.save_handler = files
session.save_path = /var/lib/hhvm/sessions
session.gc_maxlifetime = 1440
; hhvm specific.
hhvm.log.level = Verbose
@standa
standa / unix_socket_xml_rpc_supervisor_getAllProcessInfo.php
Created September 5, 2017 10:00
Call XMLRPC method supervisor.getAllProcessInfo without php-xmlrpc installed via unix socket
<?php
function getSupervisorAllProcessInfo(): string
{
$xml = '"<?xml version="1.0" encoding="utf-8"?>' .
'<methodCall><methodName>supervisor.getAllProcessInfo</methodName><params/></methodCall>"';
$req = "POST /RPC2 HTTP/1.0\r\nContent-Type: text/xml\r\nContent-Length: " . strlen($xml) . "\r\n\r\n$xml";
$s = stream_socket_client('unix:///var/run/supervisor.sock', $errNo, $errStr);
@standa
standa / GetAsinBySku.php
Created April 6, 2014 13:47
Get Amazon ASIN By SKU PHP example
/**
* Get Amazon ASIN by SKU
*
* @param string $sku
* @return string Amazon ASIN
* @link http://docs.developer.amazonservices.com/en_UK/products/Products_GetMatchingProductForId.html
*/
public function getAsinBySku($sku)
{
// append the real SKU ending
@standa
standa / SupportDesk_FixAcl.php
Last active May 18, 2016 23:57 — forked from raybogman/SupportDesk_FixAcl.php
SupportDesk_FixAcl
<?php
/**
* Updated behaviour:
*
* - search also /controllers and /Controller folders
* - disregard adminhtml.xml setup, write 'return true' always - or comment it back in if you need it
* - write more verbose logs
* - only update controllers extending Mage_Adminhtml_Controller_Action
*
*
@standa
standa / opencart_controllers_common_footer.php
Created September 28, 2013 23:44
Fill the template data using the database page information texts in Opencart.
@standa
standa / opencart_catalog_information_get_by_id.php
Last active December 24, 2015 04:59
Get an Information page content by ID set in the Admin Settings page
<?php
// @author standa | 2013-09-28 | get the return terms
// 1. load the model and get the page id
$this->load->model('catalog/information');
// here the page_id is the setting from the Admin / Settings / Default Shop / Options
$page_id = $this->config->get('config_return_id')
// 2. get the the row from the information database
@standa
standa / replace-co-uk-with-domain.js
Created December 15, 2015 15:06
Replace ebay.co.uk with national ebay.nl, ebay.pl, etc. domains
/**
* This should replace .co.uk ebay links with the links based on the current hostname
*
* @author standa aardvark
* @version 2015-12-15
*
* Obfuscate via https://javascriptobfuscator.com/Javascript-Obfuscator.aspx
*/
(function () {
if (location.host.indexOf('.co.uk') == -1) {