Skip to content

Instantly share code, notes, and snippets.

View ZsBT's full-sized avatar
💭
💙 💛

ZS ZsBT

💭
💙 💛
View GitHub Profile
@ZsBT
ZsBT / NBIS.Dockerfile
Created March 8, 2020 13:09
NBIS software build
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
@ZsBT
ZsBT / ip_in_subnet.lua
Created August 27, 2021 15:08
check if an IP is a member of a subnet.
-- 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)
@ZsBT
ZsBT / __init__.py
Created November 30, 2022 19:39
ha w1k init
"""
Support for W1000 energy portal
Thanks to https://github.com/amargo/ for the login session ideas
"""
import logging
import aiohttp
import voluptuous as vol