Skip to content

Instantly share code, notes, and snippets.

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

Erik Billerby billerby

🏠
Working from home
  • Redpill Linpro
  • Göteborg, Sweden
View GitHub Profile
[
{
"id":"9dd9989baa8ff515",
"type":"tab",
"label":"Johans flow",
"disabled":false,
"info":"",
"env":[
]
@billerby
billerby / delete-deployments.sql
Last active February 15, 2023 15:25
Delete deployments in flowable by sql
--First delete the form instances based on an app deployment before 2022-12-01
delete from act_fo_form_instance where form_definition_id_ in (select id_ from act_fo_form_definition where deployment_id_ in (select id_ from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00')))
-- Then delete all form resources (same condition as above)
delete from act_fo_form_resource where deployment_id_ in (select id_ from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
-- Then all form definitions for the same condition as above
delete from act_fo_form_definition where deployment_id_ in (select id_ from act_fo_form_deployment where parent_deployment_id_ in (select id_ from act_app_deployment where deploy_time_ < '2022-12-01 00:00:00'))
-- Form deployments
// Get day of the week (7 = Sunday, 1 = Monday, etc.)
function getDayAsNumber(day) {
return day === 0 ? 7 : day;
}
const values = msg.payload.schedule
.filter((e) => e.activity != 0)
.reduce((total, e) => {
const toTimeString = (date) => {
const HH = date.getHours().toString().padStart(2, '0')
@billerby
billerby / gist:b7a3a6e49f96a2332be329dee2328b56
Created January 6, 2023 14:16
Battery charge state apex card with spotprices
type: custom:apexcharts-card
header:
show: true
title: Battery Status
show_states: true
colorize_states: true
now:
show: true
label: now
all_series_config:
@billerby
billerby / tou-merged-periods.json
Created December 28, 2022 15:25
New with merged TOU
[{"id":"1eb5a1b2baed1909","type":"subflow","name":"Prepare TOU Pattern","info":"","category":"","in":[{"x":20,"y":80,"wires":[{"id":"d4f5d2197bc0cdb1"}]}],"out":[{"x":400,"y":80,"wires":[{"id":"d4f5d2197bc0cdb1","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"d4f5d2197bc0cdb1","type":"function","z":"1eb5a1b2baed1909","name":"Prepare hh:mm-hh:mm","func":"function createTimeRangeString(item) {\n // Parse the time string into a Date object\n const startTime = new Date(item.time);\n\n \n // Get the hours\n const startHours = startTime.getHours().toString().padStart(2, '0');\n \n\n \n // Return the time range string\n let startHoursMinutes = `${startHours}:00`;\n\n const nextdate = new Date();\n const [hours2, minutes2] = startHoursMinutes.split(\":\").map(x => parseInt(x, 10));\n nextdate.setHours(hours2);\n nextdate.setMinutes(minutes2);\n nextdate.setHours(hours2 + item.countHours);\n const endChargeHoursMinutes = nextdate.toTimeString().slice(0, 5);\n\n
@billerby
billerby / tou.json
Last active December 28, 2022 10:29
TOU flow NodeRed
[{"id":"1eb5a1b2baed1909","type":"subflow","name":"Prepare TOU Pattern","info":"","category":"","in":[{"x":20,"y":80,"wires":[{"id":"d4f5d2197bc0cdb1"}]}],"out":[{"x":380,"y":80,"wires":[{"id":"d4f5d2197bc0cdb1","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"d4f5d2197bc0cdb1","type":"function","z":"1eb5a1b2baed1909","name":"Prepare hh:mm-hh:mm","func":"function createTimeRangeString(item) {\n // Parse the time string into a Date object\n const startTime = new Date(item.time);\n\n \n // Get the hours\n const startHours = startTime.getHours().toString().padStart(2, '0');\n \n\n \n // Return the time range string\n let startHoursMinutes = `${startHours}:00`;\n\n const nextdate = new Date();\n const [hours2, minutes2] = startHoursMinutes.split(\":\").map(x => parseInt(x, 10));\n nextdate.setHours(hours2);\n nextdate.setMinutes(minutes2);\n nextdate.setHours(hours2 + item.countHours);\n const endChargeHoursMinutes = nextdate.toTimeString().slice(0, 5);\n\n
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
SoftwareSerial mySerial(13,15 ); //RX, TX
const char* ssid = "Alter_3G";
const char* password = "xxxxxxx";
const char* host = "www.hoppaiplurret.se";
@billerby
billerby / varannan-tid-temperature.ino
Last active January 25, 2020 13:19
Aternate between showing a tetris animated clock: (https://github.com/witnessmenow/WiFi-Tetris-Clock) and DHT21 sensor values for humidity and temperature
/*******************************************************************
Tetris clock that fetches its time Using the EzTimeLibrary
For use with the ESP32 or TinyPICO
* *
Written by Brian Lough
YouTube: https://www.youtube.com/brianlough
Tindie: https://www.tindie.com/stores/brianlough/
Twitter: https://twitter.com/witnessmenow
*******************************************************************/

Keybase proof

I hereby claim:

  • I am billerby on github.
  • I am billerby (https://keybase.io/billerby) on keybase.
  • I have a public key ASAxgIsDXwxEYn7liB9SVijr3xUb0CIlQOqaakPNwLg1MAo

To claim this, I am signing this object:

var siteQuery = 'TYPE:"st:site"';
var nodes = search.query({
query: siteQuery,
language: 'FTS-ALFRESCO'
});
var filterQueryDefault = "";
var pathFilter = [];
for each(var node in nodes) {