Skip to content

Instantly share code, notes, and snippets.

View ProxiBlue's full-sized avatar
🏠
Working from home

Lucas van Staden ProxiBlue

🏠
Working from home
View GitHub Profile
@ProxiBlue
ProxiBlue / maldet.pipeline.script
Created January 26, 2021 10:58
Using maldet inside a pipeline deploy
#buddy starts in the working dir
SCANDIR=$(pwd)
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -xzf maldetect-current.tar.gz
cd maldetect-1.6.4
/bin/bash ./install.sh
#make a fake vi to just echo out the report
echo '#!/bin/bash' >/usr/bin/vi
echo 'echo $1' >>/usr/bin/vi
chmod +x /usr/bin/vi
@ProxiBlue
ProxiBlue / set-config.php
Last active December 28, 2020 09:01
move mageno 2 locked config back to database
#!/usr/bin/env php
## steps
#
# fix where app:config:dump was run, adn value sin magento db is outof sync (so they ONLy exist in the dumped configs)
#
# Copy your app/etc/config.php (or app/etc/env.php) to bin folder
# delete from the app/etc/config.php (or env.php) file the values you want to re-import TO DB
# run bin/magento app:config:import (to process the changes you just made)
# run this script: ./bin/set-config.php --config config.php (or env.php)
<?php
namespace ProxiBlue\Shell\Console\Command;
use Magento\Setup\Exception;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
@ProxiBlue
ProxiBlue / qb-sdk-class-exists-patch.txt
Created May 12, 2020 13:17
quickbooks api class exists noise log patch
diff --git a/src/Core/Http/Serialization/XmlObjectSerializer.php b/src/Core/Http/Serialization/XmlObjectSerializer.php
index 1c7d865..4a4a3cc 100644
--- a/src/Core/Http/Serialization/XmlObjectSerializer.php
+++ b/src/Core/Http/Serialization/XmlObjectSerializer.php
@@ -83,9 +83,9 @@ class XmlObjectSerializer extends IEntitySerializer
private static function PhpObjFromXml($className, $xmlStr)
{
$className = trim($className);
- if (class_exists($className, CoreConstants::USE_AUTOLOADER)) {
+ if (@class_exists($className, CoreConstants::USE_AUTOLOADER)) {
@ProxiBlue
ProxiBlue / api_local.json
Last active October 20, 2019 13:36
local.json used for vagrant + magento + vuestorefront
{
"server": {
"host": "localhost",
"port": 8080,
"searchEngine": "elasticsearch"
},
"orders": {
"useServerQueue": false
},
"catalog": {
<?php
declare(strict_types=1);
namespace Enjo\Pure\Ui\DataProvider\Product\Form\Modifier;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\DynamicRows;
use Magento\Ui\Component\Form\Field;
use Magento\Ui\Component\Form\Fieldset;
use Magento\Ui\Component\Form\Element\Textarea;
@ProxiBlue
ProxiBlue / declinedTransactions.php
Created November 6, 2018 03:34
Count Declined Payments From exception.log per day
<?php
/**
* Just a rough script to parse the exception log, find all entries that match the Declined string, and group
* them by day.
* This effectively shows a major increase in a sites number of declind transactions, for which scripting was the cause
* Setup of reCapctha at checkout stopped this issue
*
* Log example:
* 2017-06-22T15:17:06+00:00 ERR (3):
* exception 'Mage_Core_Exception' with message 'Declined: 15005-This transaction cannot be processed.' in public_html/app/Mage.php:603
$('form input:text').each(function(index, elem) {
var eId = $(elem).attr('id');
var label = null;
if (eId && (label = $(elem).parents('form').find('label[for='+eId.replace(':', '\\:')+']')).length === 1) {
$(elem).attr('placeholder', $(label).html().replace(/<\/?[^>]+(>|$)/g, ""));
@ProxiBlue
ProxiBlue / gist:e797f00735fbf0a06ddb55e837b9140a
Last active February 8, 2018 01:55
Record sensibo pod temperature. added in calculation for Feel like as used by sensibo Climate React and different Apparent calculation to allow comparisons
<?php
$fp = fopen('/tmp/temp_monitor.csv', 'a');
$curl = curl_init('https://home.sensibo.com/api/v2/pods/jFFZuNq6/measurements?apiKey=MxeORFfanBUJnCbd3HLmssEYJF2WbO');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
die('error occurred during curl exec. Additional info: ' . var_export($info));
}
@ProxiBlue
ProxiBlue / gist:f7a751c9634a175bde1d6725abd7ce6c
Created February 5, 2018 02:19
Sensibo AC Climate React Scheduling via API
#!/bin/bash
STATE=$1
echo $STATE
curl -X PUT -H "Content-Type: application/json" -d '{"enabled":'${STATE}'}' https://home.sensibo.com/api/v2/pods/DEVICE_ID/smartmode/?apiKey=API KEY