2023 m. spalio 29 d., sekmadienis
AI Text-to-Speach services / Voice clone / Music generation
Music generation:
splashmusic.com - generate full length songs
lofi generator #1 #2 #3 #4
#4 lofi playlist
Text-to-Speech
https://github.com/suno-ai/bark - Realistic
https://weilbyte.github.io/tiktok-tts/ - TikToks TTS
Voice Cloning
https://beta.elevenlabs.io/speech-synthesis
https://app.uberduck.ai/speak#mode=tts-basic&voice=rick-sanchez
Other:
Tutorials:
https://rentry.org/AI-Voice-Cloning - Voice cloning using tortoise-tts
2023 m. spalio 23 d., pirmadienis
mqtt
Mqtt tools
Mqtt explorer - Install tools for testing mqtt.
mosquitto_pub - Unix tool for testing
https://testclient-cloud.mqtt.cool/ - Online tool
Brokers:
| QoS Level | Benefits |
|---|---|
| QoS 0 | - Lowest overhead |
| - Fast message delivery | |
| - No guaranteed message delivery | |
| - No message retransmissions | |
| - Suitable for non-critical data or real-time updates | |
| - Minimal impact on network bandwidth | |
| - Simple and efficient for scenarios where message loss is acceptable | |
| QoS 1 | - Ensures at least once delivery |
| - Minimal message duplication | |
| - Suitable for scenarios where some duplicates are acceptable, but loss is not | |
| - Guarantees that messages are not lost | |
| - Requires acknowledgement (PUBACK) for every message | |
| - Provides a balance between reliability and efficiency | |
| QoS 2 | - Ensures exactly once delivery |
| - No message duplication | |
| - Suitable for mission-critical and highly reliable applications | |
| - Guarantees that messages are not lost or duplicated | |
| - Most reliable but involves more overhead | |
| - Requires a complex handshake (PUB, PUBREC, PUBREL, PUBCOMP) for every message |
Connecting to mosquito TLS
I successfully established a secure TLS/MQTT connection between a publisher, a broker, and a subscriber. Here's the step-by-step procedure I followed:
1. Generate a private key:
openssl genrsa -out client.key
2. Generate the Certificate Signing Request (CSR):
openssl req -out client.csr -key client.key -new
3. Submit the CSR content to test.mosquitto.org/ssl/ and obtain the "client.crt" file.
4. Download the "mosquitto.org.crt" from test.mosquitto.org/.
5. Ensure all the following files are in the same folder:
- client.crt
- client.csr
- client.key
- mosquitto.org.crt
6. To publish, use the following command:
mosquitto_pub --cafile mosquitto.org.crt --key client.key --cert client.crt -h test.mosquitto.org -m "Hello World" -t "test" -p 8884 -d
7. On the subscriber side, use the following command:
mosquitto_sub -h test.mosquitto.org -t "test" -p 8884 --cafile mosquitto.org.crt --key client.key --cert client.crt -d
I followed this procedure on my Ubuntu PC, and the TLS/MQTT connection is working flawlessly.
Links
This guide demonstrates how to act as your own certificate authority (CA)
2023 m. rugsėjo 23 d., šeštadienis
2023 m. rugsėjo 16 d., šeštadienis
2023 m. rugsėjo 5 d., antradienis
Logging Levels
System logger
$ journalctl --unit=service
$ journalctl -fu service # To follow log as with tail -f
To limit journal logging:
$ sudo nano /etc/systemd/journald.conf
Uncomment
SystemMaxUse=100M
sudo systemctl restart systemd-journald
$ journalctl --disk-usage # How much space is used
Restart system logging
$ sudo systemctl restart rsyslog # resets /var/log/syslog, deamong.log
$ sudo systemctl restart logrotate
/usr/sbin/logrotate -f /etc/logrotate.d/spaikon # Force run logrotate
Show detailed debug trace
from loguru import logger
@logger.catch # Stack trace
Python logger
When a logger is created, the level is set to NOTSET (which causes all messages to be processed when the logger is the root logger, or delegation to the parent when the logger is a non-root logger).
Note that the root logger is created with level WARNING.
Level |
Numeric value |
|---|---|
|
50 |
|
40 |
|
30 |
|
20 |
|
10 |
|
0 |
Documentation:
2023 m. rugsėjo 1 d., penktadienis
InfluxDB
Web interface: http://localhost:8086
Package info:
$ sudo apt list --installed | grep influx
influxdb2/now 2.7.0-1 arm64 [installed,local]
installing influx:
$ sudo dpkg -i influxdb2-2.7.0-arm64.deb
watching influxdn disk-space
$ watch -d "sudo du -h /var/lib/influxdb/ | sort -rh | head -n 10"
y year (12 months)
mo month
w week (7 days)
d day
h hour (60 minutes)
m minute (60 seconds)
s second
ms milliseconds (1 thousandth of a second)
us or µs microseconds (1 millionth of a second)
ns nanoseconds (1 billionth of a second)
Websites:
About tasks:
https://docs.influxdata.com/influxdb/v2.7/process-data/get-started/
Python API:
https://docs.influxdata.com/influxdb/cloud/api-guide/client-libraries/python/
Down-sampling:
https://www.influxdata.com/blog/downsampling-influxdb-v2-0/
Examples:
https://github.com/influxdata/influxdb-client-python/tree/1ec64b7e1039c891ac3a667ee6697731c61ddbaf/examples