From 96d61f3dfc88e685d89b62bd71f7bd6a4a1962f3 Mon Sep 17 00:00:00 2001 From: daniel watson Date: Wed, 17 Feb 2016 17:56:08 -0800 Subject: [PATCH] add everything so cindy can get it --- bbb/bbb/bin/full-update.bash | 33 +++++++++++++ bbb/bbb/bin/install-opencv.bash | 32 +++++++++++++ bbb/bbb/bin/post-flash.bash | 38 +++++++++++++++ .../route-internet-through-host-via-usb.bash | 28 +++++++++++ ...llow-bbb-to-use-this-systems-internet.bash | 32 +++++++++++++ bbb/opencv-hello-world/makefile | 28 +++++++++++ bbb/opencv-hello-world/opencv-hello-world.cpp | 46 +++++++++++++++++++ bbb/post-flash.bash | 39 ++++++++++++++++ 8 files changed, 276 insertions(+) create mode 100755 bbb/bbb/bin/full-update.bash create mode 100755 bbb/bbb/bin/install-opencv.bash create mode 100755 bbb/bbb/bin/post-flash.bash create mode 100755 bbb/bbb/bin/route-internet-through-host-via-usb.bash create mode 100755 bbb/local/bin/allow-bbb-to-use-this-systems-internet.bash create mode 100644 bbb/opencv-hello-world/makefile create mode 100644 bbb/opencv-hello-world/opencv-hello-world.cpp create mode 100644 bbb/post-flash.bash diff --git a/bbb/bbb/bin/full-update.bash b/bbb/bbb/bin/full-update.bash new file mode 100755 index 0000000..1143aee --- /dev/null +++ b/bbb/bbb/bin/full-update.bash @@ -0,0 +1,33 @@ +#! /usr/bin/env bash + +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +set -o nounset +set -o errexit + +sudo -- sh -c " +set -o nounset +set -o errexit + +apt-get update && \ +apt-get install -f && \ +apt-get -y upgrade && \ +apt-get -y dist-upgrade && \ +apt-get -y autoremove +" + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . diff --git a/bbb/bbb/bin/install-opencv.bash b/bbb/bbb/bin/install-opencv.bash new file mode 100755 index 0000000..1361173 --- /dev/null +++ b/bbb/bbb/bin/install-opencv.bash @@ -0,0 +1,32 @@ +#! /usr/bin/env bash + +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +set -o nounset +set -o errexit + +#TODO: check to see which of these are actually necessary. possibly just +# the last one, libopencv-dev, is necessary +sudo aptitude install -y \ + v4l-utils \ + libopencv-core2.4 \ + libopencv-core-dev \ + libopencv-dev + +# This file is part of challenge-bot. + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . diff --git a/bbb/bbb/bin/post-flash.bash b/bbb/bbb/bin/post-flash.bash new file mode 100755 index 0000000..52bfbcb --- /dev/null +++ b/bbb/bbb/bin/post-flash.bash @@ -0,0 +1,38 @@ +#! /usr/bin/env bash + +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +# run this on the bbb while hooked to host via usb +set -o nounset +set -o errexit + +route-internet-through-host-via-usb.bash + +# TODO: set timezone on beagleboard based on host system timezone +# TODO: set time on beagleboard based on host system time + +# update the system to the latest +full-update.bash +sudo apt-get install -y aptitude +sudo aptitude install -y pkg-config + +# TODO: install opencv +install-opencv.bash + +# This file is part of challenge-bot. + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . diff --git a/bbb/bbb/bin/route-internet-through-host-via-usb.bash b/bbb/bbb/bin/route-internet-through-host-via-usb.bash new file mode 100755 index 0000000..4379bc7 --- /dev/null +++ b/bbb/bbb/bin/route-internet-through-host-via-usb.bash @@ -0,0 +1,28 @@ +#! /usr/bin/env bash + +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +set -o nounset +set -o errexit + +sudo ifconfig usb0 192.168.7.2 +sudo route add default gw 192.168.7.1 +echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf > /dev/null + +# This file is part of challenge-bot. + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . diff --git a/bbb/local/bin/allow-bbb-to-use-this-systems-internet.bash b/bbb/local/bin/allow-bbb-to-use-this-systems-internet.bash new file mode 100755 index 0000000..85d1483 --- /dev/null +++ b/bbb/local/bin/allow-bbb-to-use-this-systems-internet.bash @@ -0,0 +1,32 @@ +#! /usr/bin/env bash + +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +set -o nounset +set -o errexit + +ETH="${1}" +sudo ifconfig "${ETH}" 192.168.7.1 +sudo iptables \ + --table nat \ + --append POSTROUTING \ + --out-interface wlan0 \ + -j MASQUERADE +sudo iptables --append FORWARD --in-interface "${ETH}" -j ACCEPT +echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . diff --git a/bbb/opencv-hello-world/makefile b/bbb/opencv-hello-world/makefile new file mode 100644 index 0000000..91052dd --- /dev/null +++ b/bbb/opencv-hello-world/makefile @@ -0,0 +1,28 @@ +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +CFLAGS = `pkg-config --cflags opencv` +LIBS = `pkg-config --libs opencv` + +% : %.cpp + g++ $(CFLAGS) $(LIBS) -o $@ $< + +all: opencv-hello-world + ./opencv-hello-world + +# This file is part of challenge-bot. + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . diff --git a/bbb/opencv-hello-world/opencv-hello-world.cpp b/bbb/opencv-hello-world/opencv-hello-world.cpp new file mode 100644 index 0000000..02fea3e --- /dev/null +++ b/bbb/opencv-hello-world/opencv-hello-world.cpp @@ -0,0 +1,46 @@ +/* + Copyright (C) 2015 Daniel Watson + See the end of the file for license conditions. +*/ +/* challenge-bot + GNU AGPLv3 (or later at your option) + project available here: + https://challenge-bot.com/ +*/ +#include + +using namespace cv; +using namespace std; + +int main(int argc, char** argv) { + VideoCapture camera; + camera.open(0); + Mat edges; + Mat frame; + if(!camera.isOpened()) { + cout << "not opened :( that's bad" << endl; + exit(-1); } + camera >> frame; + Mat grey_image; + cvtColor(frame, grey_image, CV_BGR2GRAY); + + imwrite("image.png", frame); + imwrite("image-grey.png", grey_image); + return 0; } + +/* + This file is part of challenge-bot. + + Challenge-bot is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Affero Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with challenge-bot. If not, see . +*/ diff --git a/bbb/post-flash.bash b/bbb/post-flash.bash new file mode 100644 index 0000000..1169cf4 --- /dev/null +++ b/bbb/post-flash.bash @@ -0,0 +1,39 @@ +#! /usr/bin/env bash + +# Copyright (C) 2016 Daniel Watson +# See the end of the file for license conditions. +# GNU AGPLv3 (or later at your option) +# https://challenge-bot.com/ + +# run this on the bbb while hooked to host via usb +set -o nounset +set -o errexit + +route-internet-through-host-via-usb.bash + +# TODO: set timezone on beagleboard based on host system timezone +# TODO: set time on beagleboard based on host system time + +# update the system to the latest +full-update.bash +sudo apt-get install -y aptitude +sudo aptitude install -y \ + pkg-config + +# TODO: install opencv +install-opencv.bash + +# This file is part of challenge-bot. + +# Challenge-bot is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Affero Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with challenge-bot. If not, see . -- 2.30.2