This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Support for W1000 energy portal | |
Thanks to https://github.com/amargo/ for the login session ideas | |
""" | |
import logging | |
import aiohttp | |
import voluptuous as vol |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- I only found overcomplicated solutions for this small problem so I wrote this for myself. | |
-- github.com/ZsBT | |
-- convert IP string to long integer | |
local function ip2long( ip ) | |
if not ip then return false end | |
local o1,o2,o3,o4=ip:match("^(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)$") | |
if not o1 or not o2 or not o3 or not o4 then return false end | |
return tonumber(o4) + (tonumber(o3) << 8) + (tonumber(o2) << 16) + (tonumber(o1) << 24) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stable-slim | |
WORKDIR /usr/src | |
RUN apt update && apt -y install wget unzip gcc make build-essential | |
RUN wget https://nigos.nist.gov/nist/nbis/nbis_v5_0_0.zip && unzip *zip | |
RUN apt -y install cmake | |
RUN cd Rel_* && ./setup.sh /opt --without-X11 --64 && make config && make it && make install LIBNBIS=yes | |
RUN find /opt -type f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - | |
sudo add-apt-repository -y \ | |
"deb [arch=amd64] https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) \ | |
stable" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# BTRFS maintenance | |
# scrub or balance all btrfs fs present on system | |
# | |
scrub() { | |
for device in $(mount -t btrfs | cut -d ' ' -f 1 |sort -u) ;do | |
echo "scrub $device" | |
btrfs scrub start -B -c 3 -n 9 -d $device || exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# control script for HAproxy backends. | |
# | |
# rare usage does not allow me to remember socket commands... | |
# @author ZsBT@GitHub | |
# | |
_socmd(){ echo "$*" | socat stdio $(egrep -o '[^ ]+\.sock' /etc/haproxy/haproxy.cfg); } | |
[ -z "$(which socat)" ] && { echo "error: socat not installed";exit 1; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listener 1883 localhost | |
listener 2883 | |
certfile /etc/letsencrypt/live/my.example.com/cert.pem | |
cafile /etc/letsencrypt/live/my.example.com/chain.pem | |
keyfile /etc/letsencrypt/live/my.example.com/privkey.pem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create view v_sizeof_dbs as | |
select datname dbname | |
,pg_size_pretty(pg_database_size(datname)) hsize | |
from pg_database | |
order by pg_database_size(datname) desc; | |
create view v_sizeof_tables as | |
SELECT table_catalog,table_schema,table_name | |
,pg_size_pretty(pg_table_size(table_schema||'.'||table_name)) table_hsize | |
FROM information_schema.tables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description = fotók betöltése | |
After=postgresql.service | |
Requires=postgresql.service | |
Wants=postgresql.service | |
[Service] | |
ExecStart = /home/szerver/foto-devtolt.py | |
ExecReload = /bin/kill -HUP $MAINPID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# setup mysql replication. | |
# run this script parallel on both servers as we need log file name and position on the other node | |
# | |
# | |
ROOT_PASS="rootP@ssw0rd" | |
REPLI_PASS="replicationP@ssw0rd" | |
SIBLING_IP="1.2.3.4" |
NewerOlder