Skip to content

Instantly share code, notes, and snippets.

@danielkec
danielkec / rest_cmd_example.md
Last active Jun 7, 2021
Homeassistant rest_command example
View rest_cmd_example.md
View ms-teams-phone-du.md

Odevzdání DU pomocí MS Teams v mobilu

Pomocí fotoaparátu v mobilním telefonu vyfotíme domácí úkol, fotografií může být více:

Otevřeme mobilní aplikaci MS Teams a vybereme záložku: Zadání

Zadání jsou řazena ve dvou skupinách Zadáno a Dokončeno.

View ubuntu_vpn_switch_proxy.md
kec@romulus:~$ cat /etc/NetworkManager/dispatcher.d/10-vpnupdown 
#!/bin/bash

session_user="kec"
session_bus=unix:path=/run/user/$(id -u $session_user)/bus
session_display=$(who | grep $session_user | awk '{print $2}')
as_user="sudo -Hu kec DISPLAY=${session_display} DBUS_SESSION_BUS_ADDRESS=${session_bus}"

if [ "$2" = "vpn-up" ]; then
@danielkec
danielkec / verrazzano_microk8s.md
Last active Mar 5, 2021
verrazzano_microk8s.md
View verrazzano_microk8s.md

microk8s 1.18

alias kubectl='microk8s.kubectl'

sudo snap install microk8s --classic --channel=1.18/stable
microk8s start

Enable Use ServiceAccountToken volumes

View KafkaCloudEventsDependencies.xml
<dependency>
<groupId>io.helidon.microprofile.messaging</groupId>
<artifactId>helidon-microprofile-messaging</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.messaging.kafka</groupId>
<artifactId>helidon-messaging-kafka</artifactId>
</dependency>
<dependency>
<groupId>io.cloudevents</groupId>
View KafkaCloudEventSerializer.yaml
connector:
helidon-kafka:
bootstrap.servers: ${oci.test-stream.endpoint}:${oci.test-stream.port}
...
key.serializer: org.apache.kafka.common.serialization.StringSerializer
key.deserializer: org.apache.kafka.common.serialization.StringDeserializer
value.serializer: io.cloudevents.kafka.CloudEventSerializer
value.deserializer: io.cloudevents.kafka.CloudEventDeserializer
View sendCloudEvent.java
final SubmissionPublisher<CloudEvent> emitter = new SubmissionPublisher<>();
@Outgoing("to-stream")
public PublisherBuilder<CloudEvent> registerEmitter() {
return ReactiveStreams.fromPublisher(FlowAdapters.toPublisher(emitter));
}
@POST
@Path("/send/{msg}")
public void send(@PathParam("msg") String payload) {
View receiveCloudEvent.java
@Incoming("from-stream")
public void receive(CloudEvent event) {
String payload = new String(event.getData().toBytes());
}
View UDDFrankResource.java
@Incoming("from-wls-1")
public void receive1(String payld) {
sseBroadcaster.broadcast(new OutboundEvent.Builder().data("Q1: " + payld).build());
}
@Incoming("from-wls-2")
public void receive2(String payld) {
sseBroadcaster.broadcast(new OutboundEvent.Builder().data("Q2: " + payld).build());
}