Last active
October 20, 2020 17:29
-
-
Save mirontoli/b71d94ea4da162b1136d8d1d3da853cc to your computer and use it in GitHub Desktop.
This file contains 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
python3 alert-step1-server.py |
This file contains 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
cd ~ | |
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.tgz | |
tar -xvzf ngrok-stable-linux-arm.tgz |
This file contains 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
sudo apt-get install build-essential autoconf automake libtool git -y | |
git clone --recursive https://github.com/obgm/libcoap.git | |
cd libcoap | |
git checkout dtls | |
git submodule update --init --recursive | |
./autogen.sh | |
./configure --disable-documentation --disable-shared | |
make | |
sudo make install |
This file contains 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
# off | |
coap-client -m put -u "TOLLERASP0" -k "{presharedkey}" -e '{ "3311": [{ "5850": 0 }] }' "coaps://192.168.0.120:5684/15001/65537" | |
# on | |
coap-client -m put -u "TOLLERASP0" -k "{presharedkey}" -e '{ "3311": [{ "5850": 1 }] }' "coaps://192.168.0.120:5684/15001/65537" |
This file contains 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
# -region eu | |
# >/dev/null & for running in the background | |
~/ngrok http 192.168.0.193:8000 -region eu > /dev/null & |
This file contains 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
# ip address of your raspberry pi | |
echo "web_addr: 192.168.0.193:4040" >> ~/.ngrok2/ngrok.yml |
This file contains 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 http.server import BaseHTTPRequestHandler, HTTPServer | |
host_name = '192.168.0.193' | |
host_port = 8000 | |
class MyServer(BaseHTTPRequestHandler): | |
def do_HEAD(self): | |
self.send_response(200) | |
self.send_header('Content-Type', 'text/html') | |
self.end_headers() | |
def do_GET(self): | |
self.do_HEAD() | |
self.wfile.write("hej".encode("utf-8")) | |
if __name__ == '__main__': | |
http_server = HTTPServer((host_name, host_port), MyServer) | |
print("Server Starts - %s:%s" % (host_name, host_port)) | |
try: | |
http_server.serve_forever() | |
except KeyboardInterrupt: | |
http_server.server_close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment