Skip to content

Instantly share code, notes, and snippets.

Avatar

Łukasz Dywicki splatch

View GitHub Profile
View gist:88dc8c9d3338c815c03ae145d3bb9c24
# If you ever come to that point - official power query docs are not very clear
# on how to append custom headers or query options, here is how
= OData.Feed("https://....", null, [
Implementation="2.0",
Headers=[#"X-API-Token"="xyz",#"X-xyz"="zyx"],
Query=[#"timeZone"="UTC",#"another"="abc"]
])
@splatch
splatch / Main.java
Created Apr 19, 2021
Profinet DCP interaction based on experimental protocol implementation for Apache PLC4X.
View Main.java
import org.apache.plc4x.java.PlcDriverManager;
import org.apache.plc4x.java.api.PlcConnection;
import org.apache.plc4x.java.api.messages.PlcSubscriptionEvent;
import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketChannel;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
// Very simple example showing how to request profinet-dcp identification.
// Answers in line 23 are returned as PlcStruct (which is a map), for example:
@splatch
splatch / modbus.items
Created Dec 27, 2020
openHAB configuration for ineprometering PRO380-mod three phase meter.
View modbus.items
String PRO380_ModbusId "Pro 380 Modbus id" { channel="modbus:data:pro380:metadata:serialNumber:number" }
Number PRO380_Voltage_L1 "Pro 380 L1 Voltage [%.2f]" { channel="modbus:data:pro380:voltage:L1:number" }
Number PRO380_Voltage_L2 "Pro 380 L2 Voltage [%.2f]" { channel="modbus:data:pro380:voltage:L2:number" }
Number PRO380_Voltage_L3 "Pro 380 L3 Voltage [%.2f]" { channel="modbus:data:pro380:voltage:L3:number" }
Number PRO380_Current_L1 "Pro 380 L1 Current [%.2f]" { channel="modbus:data:pro380:current:L1:number" }
Number PRO380_Current_L2 "Pro 380 L2 Current [%.2f]" { channel="modbus:data:pro380:current:L2:number" }
Number PRO380_Current_L3 "Pro 380 L3 Current [%.2f]" { channel="modbus:data:pro380:current:L3:number" }
@splatch
splatch / pom.xml
Created Nov 19, 2020
Fragment of maven plugin configuration to get jaxrs stubs out of openapi generator plugin.
View pom.xml
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.3.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
@splatch
splatch / brick.csv
Created Nov 15, 2020
Example semantics tags input for OH scripts derivered from brickschema
View brick.csv
We can't make this file beautiful and searchable because it's too large.
Type,Tag,Parent,Label,Synonyms,Description
Location,Location,,,Location,
Location,Storey,Location,,Storey,
Location,Space,Location,,Space,"A part of the physical world or a virtual world whose 3D spatial extent is bounded actually or theoretically, and provides for certain functions within the zone it is contained in."
Location,Room,Space,,Room,"Base class for all more specific room types."
Location,Laboratory,Room,,Laboratory,"facility acceptable to the local, national, or international recognized authority having jurisdiction and which provides uniform testing and examination procedures and standards for meeting design, manufacturing, and factory testing requirements."
Location,Hot Box,,,Hot Box,"hot air chamber forming part of an air handler."
Location,Freezer,Laboratory,,Freezer,"cold chamber usually kept at a temperature of 22°F to 31°F (–5°C to –1°C), with high-volume air circulation."
@splatch
splatch / socketcan@.service
Last active Nov 1, 2020 — forked from sebastianhaas/socketcan-interface.service
An example systemd template unit file to setup a SocketCAN interface on startup
View socketcan@.service
[Unit]
Description=SocketCAN interface %i with a baudrate of 500000
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set %i type can bitrate 500000 ; /sbin/ifconfig %i up
ExecReload=/sbin/ifconfig %i down ; /sbin/ip link set %i type can bitrate 500000 ; /sbin/ifconfig %i up
ExecStop=/sbin/ifconfig %i down
View usb hub error-71
root@intel-corei7-64:/home/connectorio# dmesg|grep -i usb
[ 0.982102] ACPI: bus type USB registered
[ 0.983095] usbcore: registered new interface driver usbfs
[ 0.984061] usbcore: registered new interface driver hub
[ 0.985073] usbcore: registered new device driver usb
[ 1.873106] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.881511] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.889616] uhci_hcd: USB Universal Host Controller Interface driver
[ 1.899090] xhci_hcd 0000:00:15.0: new USB bus registered, assigned bus number 1
[ 1.915125] hub 1-0:1.0: USB hub found
@splatch
splatch / gist:4c7f435dfce0ff4dcaa59aec2d0b1760
Created Aug 10, 2020
BitBake error with zulu jdk after update to dunfell
View gist:4c7f435dfce0ff4dcaa59aec2d0b1760
WARNING: zulu-ezdk-x86-11.0.7-u10 do_package: KeyError in ./package/usr/share/zulu-11.0.7_10/DISCLAIMER
ERROR: zulu-ezdk-x86-11.0.7-u10 do_package: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_report_unihash(d)
0003:
File: '/work/poky/meta/classes/sstate.bbclass', lineno: 840, function: sstate_report_unihash
0836: report_unihash = getattr(bb.parse.siggen, 'report_unihash', None)
@splatch
splatch / Main.java
Last active Jul 30, 2020
PLC4X 0.6 + ADS with an extra work to read symbol table.
View Main.java
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.PlcDriverManager;
import org.apache.plc4x.java.api.PlcConnection;
@splatch
splatch / wireguard-client.bb
Last active Jul 14, 2020
Working wireguard client recipe
View wireguard-client.bb
DESCRIPTION = "Wireguard VPN client configuration on /data partition"
HOMEPAGE = "https://connectorio.com/"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# variables used to pre-populate wireguard interface
export WG_CLIENT_ADDRESS ?= ""
export WG_CLIENT_PRIVATE_KEY ?= ""
export WG_CLIENT_PRESHARED_KEY ?= ""