I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.
if ufw is not installed by default be sure to install it first.
| //BasicAuth provides authentication for calling the manual operation Sourced from here: https://stackoverflow.com/a/39591234 | |
| func BasicAuth(handler http.HandlerFunc, username, password, realm string) http.HandlerFunc { | |
| return func(w http.ResponseWriter, r *http.Request) { | |
| user, pass, ok := r.BasicAuth() | |
| if !ok || subtle.ConstantTimeCompare([]byte(user), []byte(username)) != 1 || subtle.ConstantTimeCompare([]byte(pass), []byte(password)) != 1 { | |
| w.Header().Set("WWW-Authenticate", `Basic realm="`+realm+`"`) | |
| w.WriteHeader(401) |
| func helloWorld(){ | |
| fmt.Println("Hello World!") | |
| } | |
| func main(){ | |
| go helloWorld() | |
| app: Sample Card App 1 # Name of the application, spaces are converted to _ for directory names | |
| app_info: | |
| deployment: single # Used by swarm to deploy the application: global | single | nodeName | |
| language: golang # Language the card is written in. Currently supports: golang,node, manual | |
| type: app # Denotes whether a system service, card : app | card_enabled_app | |
| version: 1 | |
| vh: | |
| - v0.6 |
| apt -y update && apt install -y build-essential git vim.tiny wget curl sudo python3 python3-setuptools | |
| cp /usr/bin/vim.tiny /usr/bin/vim | |
| mkdir /source | |
| cd /source | |
| git clone https://github.com/movidius/ncsdk.git | |
| wget https://bootstrap.pypa.io/get-pip.py |
| #!/bin/bash | |
| #docker build -t rpi_streamer_v0.5:0.1 . | |
| if [ "$#" -lt 2 ]; then | |
| echo "Usage" | |
| echo "$0 build | run version_number " | |
| exit | |
| fi |
| FROM arm64v8/ubuntu:16.04 | |
| #FROM thelimeburner/debian_base_arm64v8 | |
| RUN apt-get update -y && \ | |
| apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| libopenblas-dev \ | |
| wget \ | |
| git \ | |
| automake \ | |
| cmake \ |
| #!/bin/bash | |
| ## General Pre-reqs | |
| apt-get update -y | |
| apt-get install -y vim build-essential tmux wget git | |
| # Install Docker (source: https://help.packet.net/hardware/arm/docker-on-arm) | |
| apt-get install -y apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| #!/usr/bin/python | |
| import sys | |
| number = sys.argv[1] | |
| #print number | |
| number_text = [] |
| #!/usr/bin/python | |
| import sys | |
| number = sys.argv[1] | |
| #print number | |
| number_text = [] |