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
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 ./
@devzorg
devzorg / add-checkout-form-key.sh
Created May 25, 2018 11:26 — forked from schmengler/add-checkout-form-key.sh
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'