Skip to content

Instantly share code, notes, and snippets.

@simpleadm
simpleadm / phpdangerousfuncs.md
Created October 19, 2020 13:45 — forked from mccabe615/phpdangerousfuncs.md
Dangerous PHP Functions

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec - Executes a program
@simpleadm
simpleadm / index
Created April 10, 2019 16:54
magento-cloud list
Welcome to Magento Cloud!
Project title: PROJECT_NAME
Project ID: PROJECT_ID
Project dashboard: https://eu.magento.cloud/#/projects/PROJECT_ID
Your environments are:
+-------------------+-------------+----------+
| ID | Title | Status |
+-------------------+-------------+----------+
@simpleadm
simpleadm / ApiDataInterface
Last active February 15, 2019 06:39
PhpStorm File and code templates for Magento 2
<?php
#parse("PHP File Header.php")
#set($current = "")
#set($MODULE_NAMESPACE = "")
#foreach($current in $MODULE_NAME.split("_"))
#set($MODULE_NAMESPACE = $MODULE_NAMESPACE + "\" + $current)
#end
namespace $MODULE_NAMESPACE.substring(1)\Api\Data;
/**
@simpleadm
simpleadm / mview.sql
Last active September 26, 2018 13:15 — forked from unicoder88/mview.sql
select s.view_id,
s.version_id,
s.status,
(SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id,
(select count(*) from catalog_product_price_cl cl where cl.version_id > s.version_id) as pending_updates
from mview_state s where s.view_id = 'catalog_product_price'
UNION
select s.view_id, s.version_id, s.status, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from catalog_product_flat_cl cl where cl.version_id > s.version_id) as pending_updates from mview_state s where s.view_id = 'catalog_product_flat'
UNION
select s.view_id, s.version_id, s.status, (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database() AND TABLE_NAME = concat(s.view_id, '_cl')) as increment_id, (select count(*) from cataloginventory_stock_cl cl where cl.version_id > s.version_id) as pending_upd
import requests
import json
import argparse
import urllib.parse
from itertools import groupby
from datetime import datetime
def parse_args():
parser = argparse.ArgumentParser()
#!/usr/bin/env python
# coding: utf-8
# copyright: 2011, Igor Katson, igor.katson@gmail.com
"""What this script does, is logartihmically keep files, that means,
when you provide a dir, or a file pattern to it, it can calculate,
which files to keep based on the following parameters:
- keep 1 file each day for --days days,
- keep 1 file each week for --weeks weeks (after --days processing)
@simpleadm
simpleadm / my.cnf
Created December 28, 2017 11:23 — forked from yvoronoy/my.cnf
MySQL Magento Config
[mysqld]
## After edit config you have to remove log files and restart mysql server
## because after changing innodb-log-file-size you should recreate ib_logfiles
## Stop MySQL server
## rm /data/dir/ib_logfile*
## Run MySQL server
##Table open cache under MacOS and MySQL 5.6 should be 250.
##Otherwise you will get error MySQL server has gone away
##table-open-cache = 250