Skip to content

Instantly share code, notes, and snippets.

hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
#!/usr/bin/python
# use it with argument - url to sitemap, e.g. http://example.com/sitemap.xml
# it just prints out errors, use > fielname.log to logging into the file
try:
from urllib2 import urlopen, Request, HTTPError, URLError
except ImportError:
from urllib.request import urlopen, Request, HTTPError, URLError
import signal
import threading
@devzorg
devzorg / eGPU
Last active March 6, 2017 11:55
По статье https://habrahabr.ru/post/182676/
только чтобы дешифрованный файл прошивки получить надо смонтировать из ком. строки из под админа системный диск mount /s X: там будет файл
прошивки с расширением bin (у меня это было 01818.bin) далее все как в статье. Грузимся с флешки предварительно установив в bios Legacy
Boot режим, загрузились ... выставили нужные опции и убрали Legacy режим.
Для получения списка опций только вместо 11 пункта и далее используем Universal EFI Extractor из этой статьи
https://habrahabr.ru/post/211879/ (у меня и с перловым скриптом получилось, но только на сервере запустить, на винде не получилось
нормально дамп сделать а Universal EFI Extractor на винде работает хорошо).
https://github.com/1487quantum/ard-projects/tree/master/rgbstrip_sk6812
@devzorg
devzorg / mage-reset
Last active August 19, 2017 09:04
Magento reset script to restore right permissions
#!/bin/sh
#if you have difficulties with permissions just run in root of magento dir
#default permissions gets from var/cache or index.php else use arg like owner:group
path="index.php"
if [ -z $1 ]; then
if [ -d "var/cache" ]; then
path="var/cache"
fi
perm=$(stat -c "%U:%G" $path)
else
@devzorg
devzorg / magento_url_rewrite.patch
Created December 15, 2017 09:10 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
diff -rupN src_org/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php src_patched/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php
--- src_org/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php 2016-02-17 19:27:54.000000000 +0100
+++ src_patched/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php 2017-05-04 16:36:44.349301447 +0200
@@ -114,7 +114,7 @@ class Mage_SalesRule_Model_Rule_Conditio
$attr = $this->getAttribute();
$total = 0;
foreach ($object->getQuote()->getAllVisibleItems() as $item) {
- if (parent::validate($item)) {
+ if (Mage_Rule_Model_Condition_Combine::validate($item)) {
$total += $item->getData($attr);
@devzorg
devzorg / arduino.tasks
Created December 22, 2017 08:07
Arduino Tasks
1. Дано: увлажнитель 220В
Цель: включать/выключать по влажности автоматически.
Решение: запихнуть в сетевой фильтр или какой нибудь удлинитель или розетку с вилкой, в общем чтобы был конечный внешний вид.
Примечание: sonoff + am2301, есть приложение и сценарии, по-моему самое то
2. Дано: Есть щиток, есть генератор
Цель: удаленно заглушить бензогенератор.
Задача: обрывать цепь реле (предполагается реле + nRF24L01+) и через минуту возвращать, но генератор уже будет заглушен.
3. Дано: погреб
@devzorg
devzorg / patch-7136
Created January 11, 2018 14:03 — forked from molotovbliss/patch-7136
Magento v1 SUPEE-7136 Cookies : 'frontend_cid' is never renewed, compared to 'frontend' one. So session often expires.
Sauce: https://community.magento.com/t5/Technical-Issues/Cookies-frontend-cid-is-never-renewed-compared-to-frontend-one/td-p/41077
The core code seems to have forgotten to include the logic to renew the frontend_cid cookie.
I have contacted Magento support regarding this and they provided me a patch - SUPEE-7136, however I'm not seeing it published online anywhere...
The issue lies in this file:
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
What the patch does is replace this:
#!/bin/bash
USER=user
PASS=pass
DBNAME=dbname
BKP_PATH=/backups
PATH=/var/www/site/data/www
mysqldump -u${USER} -p --lock-tables=false --single-transaction --quick --hex-blob --routines --triggers ${DBNAME} | gzip > ${DBNAME}_(DATE).sql.gz &
tar -C ${PATH} -zcpf ${BKP_PATH}/${DBNAME}.tgz ./