Skip to content

Instantly share code, notes, and snippets.

@wujku
wujku / FulltextIndexForTechnicalDescription.php
Created March 19, 2025 15:50
Create FULLTEXT index for localized column – Pimcore
<?php
namespace AppBundle\EventListener\ClassDefinition;
use Exception;
use Pimcore\Db;
use Pimcore\Event\Model\DataObject\ClassDefinitionEvent;
use Pimcore\Logger;
use Pimcore\Tool;
@wujku
wujku / EdPrinter_letter_E_pen_program.py
Last active July 7, 2024 11:46
Draw the letter E with EdPrinter
#-------------Setup----------------
import Ed
Ed.EdisonVersion = Ed.V2
Ed.DistanceUnits = Ed.CM
Ed.Tempo = Ed.TEMPO_MEDIUM
#--------Your code below-----------
@wujku
wujku / default.vcl
Created March 20, 2024 08:24
Advanced VCL with Varnish sharding example (Magento 2)
# VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 6
vcl 4.0;
import directors;
import std;
# The minimal Varnish version is 6.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
# Define probe used for heartbeat
@wujku
wujku / add-gitlab-deploy-key-to-group-projects.sh
Last active November 28, 2023 10:06
Add a deploy key to projects from a specific group, taking into account that the API returns results with a limit of 100 elements per page
#!/bin/bash
# Zmienne
GITLAB_API="https://gitlab.com/api/v4" # Zmień na adres swojego GitLab
GROUP_ID="19" # Zmień na ID grupy, z której chcesz wyciągnąć projekty
DEPLOY_KEY_ID=$1 # Zmień na ID klucza deploy
# Print helpFunction in case parameters are empty
if [ -z "$DEPLOY_KEY_ID" ]
then
@wujku
wujku / pimcore_previously_opened_tab_with_object.js
Last active November 24, 2022 08:45
Check if object from grid row was already opened as other tab
if (pimcore.globalmanager.exists("object_" + this.getStore().getAt(index).data.id)) {
// Your implementation
}
@wujku
wujku / daily_power_consumption
Last active November 1, 2022 18:24
InfluxDB – Power consumption
from(bucket: "home_assistant")
|> range(start: -30d)
|> filter(fn: (r) => r._measurement == "imp" and r._field == "value")
|> aggregateWindow(every: 1d, fn: spread, createEmpty: false)
|> map(fn: (r) => ({r with _value: r._value / 1000.0 }))
|> yield(name: "daily total")
@wujku
wujku / index.html
Created October 5, 2022 16:05
Smart home dashboard controller UI
<div class="dashboard">
<header>
<div class="f fe">
<div class="icon icon-w"></div>
<div class="heading">
<h5 class="date">1 Feb 2019</h5>
<h2 class="title">Cloudy</h2>
</div>
</div>
var panel = new Ext.form.FormPanel({
title: 'Example',
width: 350,
items: [],
listeners: {
add: function(me, component, index) {
component.on('change', function(f,n,o) {
alert('detected! '+f.label+' value changed from '+o+' to '+n);
console.log(component.startValue);
});
binary_sensor:
- platform: template
sensors:
pc_relay_cwu_pump:
friendly_name: "Pompa CWU"
value_template: "{{ state_attr('sensor.heat_pump', 'relay_cwu_pump') }}"
device_class: power
pc_relay_co_pump:
friendly_name: "Pompa CO"
value_template: "{{ state_attr('sensor.heat_pump', 'relay_co_pump') }}"
@wujku
wujku / 4button_scene_switch_zha.yaml
Last active July 26, 2025 21:02
Blueprint for 4-Button Scene Switch (TS0044) – Home Assistant – Improved version of https://community.home-assistant.io/t/zha-tuya-4-button-scene-switch-ts0044/265099
blueprint:
name: ZHA - 4-Button Scene Switch
description: Automate your 4-Button Scene Switch via ZHA events.
domain: automation
input:
4button_scene_switch:
name: 4-Button Scene Switch
description: 4-Button Scene Switch to use
selector:
device: