6 Commits

Author SHA1 Message Date
d3m1g0d
e3231095c4 Merge branch 'Testing-json' of https://github.com/d3m1g0d/TeraHz into Testing-json 2019-03-26 19:06:42 +01:00
d3m1g0d
9d3a3419c8 fuck me. 2019-03-26 19:06:00 +01:00
d3m1g0d
548337258f simplifying a lot of shit 2019-03-26 19:05:42 +01:00
ANormalPerson1
51d6695fec Attempting request.post and request.get_json
Attempting to understand what the various methods do, do to differing documentation on some parts.
To current knowledge, get_json gets a json file from the webserver, whilst post uploads one. On to how to access the uploaded json with html, I will work on.
2019-03-23 10:20:53 +01:00
ANormalPerson1
d938937d48 request.json -> request.get_json()
Apparently, the json method of request is considered deprecated, src https://stackoverflow.com/questions/20001229/how-to-get-posted-json-in-flask
So swallep it out for request.get_json
2019-03-23 09:50:40 +01:00
ANormalPerson1
9677273f55 Attempt at doing json
I fucked up big time. I have attempted to make a custom made chart, while, to my knowledge, one is readily available and more easily incorporated to the website design.
2019-03-21 21:18:05 +01:00
110 changed files with 165 additions and 20857 deletions

Binary file not shown.

1
.gitignore vendored
View File

@@ -1 +0,0 @@
site/

View File

@@ -1,14 +0,0 @@
Copyright (c) 2018, 2019, Kristjan Komloši, Jakob Kosec, Juš Dolžan,
TeraHz development team
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -1,8 +1,4 @@
# TeraHz
[![Documentation Status](https://readthedocs.org/projects/terahz/badge/?version=latest)](https://terahz.readthedocs.io/en/latest/?badge=latest)
TeraHz is a low-cost spectrometer based on a Raspberry Pi 3 or 3 B+ and three sensors:
+ [__AS7265x__](https://www.tindie.com/products/onehorse/compact-as7265x-spectrometer/)
is a 18 channel spectrometer chipset that provides the device with spectral data
@@ -16,9 +12,6 @@ Because people and institutions could use an affordable and accurate light-analy
## Development team
Copyright 2018, 2019
- Kristjan "cls-02" Komloši (electronics, sensor drivers, backend)
- Jakob "D3m1j4ck" Kosec (frontend)
I would also like to thank Juš "ANormalPerson" Dolžan, who decided to leave the
team, but helped me a lot with backend development.
- Kristjan "d3m1g0d" Komloši (electronics, middleware)
- Juš "ANormalPerson" Dolžan (backend)
- Jakob "D3m1j4ck" Kosec (frontend, website)

View File

@@ -1,16 +0,0 @@
# app.py - main backend program
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
from flask import Flask, redirect, url_for, request
import flask
import sensors
import json
app = Flask(__name__)
s=sensors.Spectrometer(path='/dev/serial0', baudrate=115200, tout=1)
u=sensors.UVSensor()
l=sensors.LxMeter()
@app.route('/data')
def sendData():
response = flask.jsonify([s.getData(), l.getData(), u.getABI()])
response.headers.add('Access-Control-Allow-Origin', '*')
return response

9
backend/graph.js Normal file
View File

@@ -0,0 +1,9 @@
$(document).ready(function() {
$(chart_id).highcharts({
chart: chart,
title: title,
xAxis: xAxis,
yAxis: yAxis,
series: series
});
});

34
backend/main.py Normal file
View File

@@ -0,0 +1,34 @@
from flask import Flask, redirect, url_for, request, render_template
app = Flask(__Name__)
URL = "" #Insert url of website here
@app.route('/list')
def list():
#Return list json
@app.route('/load'):
def load():
#Request args, load json
@app.route('/deposit'):
def deposit():
#Request .json, store json
if request.isJson():
content = request.get_json(url = URL)
return content
@app.route('/post', , methods = ['POST']):
def post():
request.post(url = URL, data = "") #Insert the data you wish to upload
@app.route('/graph')
def graph(chartID = 'chart_ID', chart_type = 'line', chart_height = 500):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
xAxis = {"categories": ['xAxis Data1', 'xAxis Data2', 'xAxis Data3']}
yAxis = {"title": {"text": 'yAxis Label'}}
return render_template('index.html', chartID=chartID, chart=chart, series=series, title=title, xAxis=xAxis, yAxis=yAxis)
if __name__ == "__main__":
app.run(debug = True, host='0.0.0.0', port=8080, passthrough_errors=True)

Binary file not shown.

View File

@@ -1,6 +1,7 @@
# sensors.py - a module for interfacing to the sensors
# Copyright 2019 Kristjan Komloši
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
# The code in this file is licensed under the 3-clause BSD License
import serial as ser
import pandas as pd
import smbus2
@@ -64,7 +65,7 @@ class Spectrometer:
responseorder = [i for i in 'RSTUVWGHIJKLABCDEF']
realorder = [i for i in 'ABCDEFGHRISJTUVWKL']
response = pd.Series([float(i)/35.0 for i in rawresp[:-3].split(',')], index=responseorder)
return pd.DataFrame(response, index=realorder, columns = ['uW/cm^2']).to_dict()['uW/cm^2']
return pd.DataFrame(response, index=realorder, columns = ['uW/cm^2'])
def __init__(self, path='/dev/ttyUSB0', baudrate=115200, tout=1):
@@ -72,7 +73,7 @@ class Spectrometer:
self.baudrate = baudrate
self.timeout = 1
try:
self.serialObject = ser.Serial(path, baudrate, timeout=tout)
self.serialObject =
except:
raise Exception('An exception occured when opening the serial port at {}'.format(path))
ex(1)
@@ -161,7 +162,6 @@ class LxMeter:
class UVSensor:
def __init__(self, bus=1, addr=0x10):
self.addr=addr
try:
self.bus = smbus2.SMBus(bus)
except:
@@ -169,7 +169,7 @@ class UVSensor:
try:
# enable the sensor and set the integration time
self.bus.write_byte_data(self.addr, 0x00, 0b00010000)
self.bus.write_byte_data(addr, 0x00, 0b00010000)
except:
raise Exception('An exception occured when initalizing the UV Sensor')
@@ -179,10 +179,10 @@ class UVSensor:
try:
# read the raw UVA, UVB and compensation values from the sensor
aRaw = self.bus.read_word_data(self.addr, 0x07)
bRaw = self.bus.read_word_data(self.addr, 0x09)
c1 = self.bus.read_word_data(self.addr, 0x0a)
c2 = self.bus.read_word_data(self.addr, 0x0b)
aRaw = self.bus.read_word_data(addr, 0x07)
bRaw = self.bus.read_word_data(addr, 0x09)
c1 = self.bus.read_word_data(addr, 0x0a)
c2 = self.bus.read_word_data(addr, 0x0b)
except:
raise Exception('An exception occured when fetching raw UV data')
# scary computations ahead! refer to Vishay app note 84339 and Sparkfun
@@ -197,7 +197,7 @@ class UVSensor:
b = bCorr * 0.00125
# last, calculate the UV index
i = (a + b) / 2
i = (uva + uvb) / 2
return [a,b,i]
@@ -215,7 +215,7 @@ class UVSensor:
try:
# write the default value for power on
# no configurable params = no bitmask
self.bus.write_byte_data(self.addr, 0x00, 0x10)
self.bus.write_byte_data(addr, 0x00, 0x10)
except:
raise Exception('An exception occured when turning the UV sensor on')
@@ -224,6 +224,6 @@ class UVSensor:
try:
# write the default value + the shutdown bit
# no configurable params = no bitmask
self.bus.write_byte_data(self.addr, 0x00, 0x11)
self.bus.write_byte_data(addr, 0x00, 0x11)
except:
raise Exception('An exception occured when shutting the UV sensor down')

View File

@@ -1,6 +1,6 @@
# storage.py - storage backend for TeraHz
# Copyright Kristjan Komloši 2019
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
# This code is licensed under the 3-clause BSD license
import sqlite3

View File

@@ -1,165 +0,0 @@
## Warning
The recommended way of getting TeraHz is the official Raspberry Pi SD card image
provided under the releases tab in the GitHub repository. Installing TeraHz from
source is a time consuming and painful process, even more so if you don't know
what you're doing, and whatever you end up building __will not be officially
supported__ (unless you're a core developer).
With this warning out of the way, let's begin.
## Getting the latest sources
The most reliable way to get working source code is by cloning the official
GitHub repository and checking out the `development-stable` tag. This tag marks
the latest confirmed working commit. Building from the master branch is somewhat
risky, and building from development branches is straight up stupid if you're
not a developer.
Make sure that the repository is cloned into `/home/pi/TeraHz`, as Lighttpd
expects to find frontend files inside this directory.
After cloning and checking out, check the documentation for module dependencies
and the required version of python in the `docs/dependencies.md` file.
## Installing Python
This step depends a lot on the platform you're using. TeraHz was developed with
Raspberry Pi and Raspbian in mind. If you're familiar with Raspbian enough,
you'll know that the latest version of Python available is `3.5`, which is too
obsolete to run TeraHz and the required modules consistently. This leaves us
with compiling Python from source. __This step is guaranteed to be slow,
overnight compiling with something like tmux is recommended.__
### Pre-requirements
Installing python without most C libraries will lead to a rather minimalistic
Python install, missing a lot of important modules. To prevent this, update
the system packages. After that, reboot.
```
sudo apt update
sudo apt full-upgrade
sudo reboot
```
Install the required build tools, libraries and their headers.
```
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev \
libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev \
libexpat1-dev liblzma-dev zlib1g-dev
```
### Compiling
Compiling Python from source is, in fact pretty easy, just time-consuming. To combat
that, using tmux to detach and later reattach the session is advised.
Python is packaged in many forms, but you'll be using the most basic
of them all: a gzipped tarball. Download and decompress it, then cd into its
directory.
```
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
tar -xzf Python-3.6.8.tgz
cd Python-3.6.8
```
Python's build process is pretty classic, a `.configure` script and a Makefile.
Using the `-j` option with Make can reduce the compile time significantly. Go
with as many threads as you have cores: `-j 4` works great on the Pi 3 B/B+.
```
./configure
make -j4
```
When the compilation ends, install your freshly built version of python.
```
sudo make altinstall
```
"Altinstall" means that the new version of Python will be installed beside the
existing version, and all related commands will use the full naming scheme:
think `python3.6` or `pip3.6` instead of the shorter `python3` or `pip3`.
### Modules
Another painfully slow part is the installation of all the required modules
needed by TeraHz. Luckily, `pip3.6` takes care of the entire installation
process. As before, using tmux is advised.
```
pip3.6 install smbus pyserial flask pandas
```
## Raspi-config
For some law-obeying reason, Raspbian locks down the Wi-Fi interface card until
the Wi-Fi country is set. This means that we will need to set it manually through
the `raspi-config` program. It requires superuser privileges.
```
sudo raspi-config
```
![1](imgs/raspi-config/1.png)
Configure the network hostname to something specific. If setting up multiple
TeraHz machines, make their hostnames unique so you can tell them apart.
![](imgs/raspi-config/3.png)
![](imgs/raspi-config/4.png)
Enable SSH and I2C interfaces.
![](imgs/raspi-config/15.png)
![](imgs/raspi-config/5.png)
![](imgs/raspi-config/6.png)
![](imgs/raspi-config/7.png)
![](imgs/raspi-config/19.png)
Expand the root filesystem along the entire SD card.
![](imgs/raspi-config/17.png)
![](imgs/raspi-config/8.png)
![](imgs/raspi-config/9.png)
Set the Wi-Fi country to the country you'll be using TeraHz in.
![](imgs/raspi-config/10.png)
![](imgs/raspi-config/11.png)
![](imgs/raspi-config/12.png)
![](imgs/raspi-config/13.png)
![](imgs/raspi-config/14.png)
Save and reboot to enable Wi-Fi
## Installing packages
In addition to what's already installed, TeraHz requires the following daemons
to run:
- Lighttpd - Frontend HTTP server
- Dnsmasq - DNS and DHCP server, used to redirect the `terahz.site` domain
- Hostapd - Wi-Fi access point
They are available from the Raspbian repository. Install it via `apt`.
```
apt install hostapd dnsmasq hostapd
```
## Configuring daemons
By default, the daemons we installed are disabled and start only manually. To
change that, enable them through systemctl. Hostapd conflicts with
wpa_supplicant, the solution is to disable wpa_supplicant (this will break your
wireless connections, so use wired ethernet).
```
sudo systemctl unmask hostapd
sudo systemctl stop wpa_supplicant
sudo systemctl disable wpa_supplicant
sudo systemctl enable dnsmasq hostapd lighttpd
```
## Copying configuration files
To simplify the process of configuring Raspbian to run TeraHz, sample
configuration file are provided in the `etcs` subdirectory of the Git
repository.
These files have been verified to work, but it's not a brilliant idea to just
copy them into your `/etc` directory. Use them carefully and more as a template
for your own configuration rather than as a _de facto_ way of configuring
TeraHz.

View File

@@ -1,25 +0,0 @@
The current development version of TeraHz has been verified to work with:
- Raspbian Stretch (9)
- Python 3.6.8 (built from source code and altinstall'd)
- Module versions (direct `pip3.6 list` output):
```
Package Version
--------------- ---------
Click 7.0
Flask 1.0.3
itsdangerous 1.1.0
Jinja2 2.10.1
MarkupSafe 1.1.1
numpy 1.16.4
pandas 0.24.2
pip 18.1
pyserial 3.4
python-dateutil 2.8.0
pytz 2019.1
setuptools 40.6.2
six 1.12.0
smbus 1.1.post2
Werkzeug 0.15.4
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1 +0,0 @@
This is the start page for the TeraHz documentation.

View File

@@ -1,4 +0,0 @@
# 1 = Try to detect unicast dns servers that serve .local and disable avahi in
# that case, 0 = Don't try to detect .local unicast dns servers, can cause
# troubles on misconfigured networks
AVAHI_DAEMON_DETECT_LOCAL=1

View File

@@ -1,20 +0,0 @@
# Defaults for bluez
# start bluetooth on boot?
# compatibility note: if this variable is _not_ found bluetooth will start
BLUETOOTH_ENABLED=1
# This setting used to switch HID devices (e.g mouse/keyboad) to HCI mode, that
# is you will have bluetooth functionality from your dongle instead of only
# HID. This is accomplished for supported devices by udev in
# /lib/udev/rules.d/62-bluez-hid2hci.rules by invoking hid2hci with correct
# parameters.
# See /usr/share/doc/bluez/NEWS.Debian.gz for further information.
# Older daemons like pand dund and hidd can be found in bluez-compat package as
# they are deprecated and provided for backward compatibility only.
# Note that not every bluetooth dongle is capable of switching back to HID mode,
# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=355497
HID2HCI_ENABLED=0
HID2HCI_UNDO=0

View File

@@ -1,4 +0,0 @@
# Uncomment the following line if you'd like all of your users'
# ~/calendar files to be checked daily. Calendar will send them mail
# to remind them of upcoming events. See calendar(1) for more details.
#RUN_DAILY=true

View File

@@ -1,16 +0,0 @@
# CONFIGURATION FILE FOR SETUPCON
# Consult the console-setup(5) manual page.
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE=""
FONTSIZE=""
VIDEOMODE=
# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'

View File

@@ -1,11 +0,0 @@
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
# the initial regulatory domain setting for IEEE 802.11 devices which operate
# on this system.
#
# Governments assert the right to regulate usage of radio spectrum within
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
# country code suitable for your location or you may infringe on local
# legislature. See `/usr/share/zoneinfo/zone.tab' for a table of timezone
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.
REGDOMAIN=

View File

@@ -1,28 +0,0 @@
# Cron configuration options
# Whether to read the system's default environment files (if present)
# If set to "yes", cron will set a proper mail charset from the
# locale information. If set to something other than 'yes', the default
# charset 'C' (canonical name: ANSI_X3.4-1968) will be used.
#
# This has no effect on tasks running under cron; their environment can
# only be changed via PAM or from within the crontab; see crontab(5).
READ_ENV="yes"
# Extra options for cron, see cron(8)
#
# For example, to enable LSB name support in /etc/cron.d/, use
# EXTRA_OPTS='-l'
#
# Or, to log standard messages, plus jobs with exit status != 0:
# EXTRA_OPTS='-L 5'
#
# For quick reference, the currently available log levels are:
# 0 no logging (errors are logged regardless)
# 1 log start of jobs
# 2 log end of jobs
# 4 log jobs with exit status != 0
# 8 log the process identifier of child process (in all logs)
#
#EXTRA_OPTS=""

View File

@@ -1,7 +0,0 @@
# This is a configuration file for /etc/init.d/dbus; it allows you to
# perform common modifications to the behavior of the dbus daemon
# startup without editing the init script (and thus getting prompted
# by dpkg on upgrades). We all love dpkg prompts.
# Parameters to pass to dbus.
PARAMS=""

View File

@@ -1,33 +0,0 @@
# This file has five functions:
# 1) to completely disable starting dnsmasq,
# 2) to set DOMAIN_SUFFIX by running `dnsdomainname`
# 3) to select an alternative config file
# by setting DNSMASQ_OPTS to --conf-file=<file>
# 4) to tell dnsmasq to read the files in /etc/dnsmasq.d for
# more configuration variables.
# 5) to stop the resolvconf package from controlling dnsmasq's
# idea of which upstream nameservers to use.
# For upgraders from very old versions, all the shell variables set
# here in previous versions are still honored by the init script
# so if you just keep your old version of this file nothing will break.
#DOMAIN_SUFFIX=`dnsdomainname`
#DNSMASQ_OPTS="--conf-file=/etc/dnsmasq.alt"
# Whether or not to run the dnsmasq daemon; set to 0 to disable.
ENABLED=1
# By default search this drop directory for configuration options.
# Libvirt leaves a file here to make the system dnsmasq play nice.
# Comment out this line if you don't want this. The dpkg-* are file
# endings which cause dnsmasq to skip that file. This avoids pulling
# in backups made by dpkg.
CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
# If the resolvconf package is installed, dnsmasq will use its output
# rather than the contents of /etc/resolv.conf to find upstream
# nameservers. Uncommenting this line inhibits this behaviour.
# Note that including a "resolv-file=<filename>" line in
# /etc/dnsmasq.conf is not enough to override resolvconf if it is
# installed: the line below must be uncommented.
IGNORE_RESOLVCONF=yes

View File

@@ -1,2 +0,0 @@
# Uncomment to set clock even if saved value appears to be in the past
#FORCE=force

View File

@@ -1,20 +0,0 @@
# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"
# Additional daemon options to be appended to hostapd command:-
# -d show more debug messages (-dd for even more)
# -K include key data in debug messages
# -t include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

View File

@@ -1,19 +0,0 @@
# Defaults for the hwclock init script. See hwclock(5) and hwclock(8).
# This is used to specify that the hardware clock incapable of storing
# years outside the range of 1994-1999. Set to yes if the hardware is
# broken or no if working correctly.
#BADYEAR=no
# Set this to yes if it is possible to access the hardware clock,
# or no if it is not.
#HWCLOCKACCESS=yes
# Set this to any options you might need to give to hwclock, such
# as machine hardware clock type for Alphas.
#HWCLOCKPARS=
# Set this to the hardware clock device you want to use, it should
# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option.
#HCTOSYS_DEVICE=rtc0

View File

@@ -1,10 +0,0 @@
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="gb"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"

View File

@@ -1,2 +0,0 @@
# File generated by update-locale
LANG=en_GB.UTF-8

View File

@@ -1,11 +0,0 @@
# Configuration for networking init script being run during
# the boot sequence
# Set to 'no' to skip interfaces configuration on boot
#CONFIGURE_INTERFACES=yes
# Don't configure these interfaces. Shell wildcards supported/
#EXCLUDE_INTERFACES=
# Set to 'yes' to enable additional verbosity
#VERBOSE=no

View File

@@ -1,19 +0,0 @@
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=
# Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
STATDOPTS=
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=

View File

@@ -1,37 +0,0 @@
# /etc/default/nss
# This file can theoretically contain a bunch of customization variables
# for Name Service Switch in the GNU C library. For now there are only
# four variables:
#
# NETID_AUTHORITATIVE
# If set to TRUE, the initgroups() function will accept the information
# from the netid.byname NIS map as authoritative. This can speed up the
# function significantly if the group.byname map is large. The content
# of the netid.byname map is used AS IS. The system administrator has
# to make sure it is correctly generated.
#NETID_AUTHORITATIVE=TRUE
#
# SERVICES_AUTHORITATIVE
# If set to TRUE, the getservbyname{,_r}() function will assume
# services.byservicename NIS map exists and is authoritative, particularly
# that it contains both keys with /proto and without /proto for both
# primary service names and service aliases. The system administrator
# has to make sure it is correctly generated.
#SERVICES_AUTHORITATIVE=TRUE
#
# SETENT_BATCH_READ
# If set to TRUE, various setXXent() functions will read the entire
# database at once and then hand out the requests one by one from
# memory with every getXXent() call. Otherwise each getXXent() call
# might result into a network communication with the server to get
# the next entry.
#SETENT_BATCH_READ=TRUE
#
# ADJUNCT_AS_SHADOW
# If set to TRUE, the passwd routines in the NIS NSS module will not
# use the passwd.adjunct.byname tables to fill in the password data
# in the passwd structure. This is a security problem if the NIS
# server cannot be trusted to send the passwd.adjuct table only to
# privileged clients. Instead the passwd.adjunct.byname table is
# used to synthesize the shadow.byname table if it does not exist.
ADJUNCT_AS_SHADOW=TRUE

View File

@@ -1,11 +0,0 @@
# Defaults for raspberrypi-kernel
# Uncomment the following line to enable generation of
# /boot/initrd.img-KVER files (requires initramfs-tools)
#INITRD=Yes
# Uncomment the following line to enable generation of
# /boot/initrd(7).img files (requires rpi-initramfs-tools)
#RPI_INITRD=Yes

View File

@@ -1,47 +0,0 @@
# defaults file for rsync daemon mode
#
# This file is only used for init.d based systems!
# If this system uses systemd, you can specify options etc. for rsync
# in daemon mode by copying /lib/systemd/system/rsync.service to
# /etc/systemd/system/rsync.service and modifying the copy; add required
# options to the ExecStart line.
# start rsync in daemon mode from init.d script?
# only allowed values are "true", "false", and "inetd"
# Use "inetd" if you want to start the rsyncd from inetd,
# all this does is prevent the init.d script from printing a message
# about not starting rsyncd (you still need to modify inetd's config yourself).
RSYNC_ENABLE=false
# which file should be used as the configuration file for rsync.
# This file is used instead of the default /etc/rsyncd.conf
# Warning: This option has no effect if the daemon is accessed
# using a remote shell. When using a different file for
# rsync you might want to symlink /etc/rsyncd.conf to
# that file.
# RSYNC_CONFIG_FILE=
# what extra options to give rsync --daemon?
# that excludes the --daemon; that's always done in the init.d script
# Possibilities are:
# --address=123.45.67.89 (bind to a specific IP address)
# --port=8730 (bind to specified port; default 873)
RSYNC_OPTS=''
# run rsyncd at a nice level?
# the rsync daemon can impact performance due to much I/O and CPU usage,
# so you may want to run it at a nicer priority than the default priority.
# Allowed values are 0 - 19 inclusive; 10 is a reasonable value.
RSYNC_NICE=''
# run rsyncd with ionice?
# "ionice" does for IO load what "nice" does for CPU load.
# As rsync is often used for backups which aren't all that time-critical,
# reducing the rsync IO priority will benefit the rest of the system.
# See the manpage for ionice for allowed options.
# -c3 is recommended, this will run rsync IO at "idle" priority. Uncomment
# the next line to activate this.
# RSYNC_IONICE='-c3'
# Don't forget to create an appropriate config file,
# else the daemon will not start.

View File

@@ -1,4 +0,0 @@
# Options for rsyslogd
# -x disables DNS lookups for remote messages
# See rsyslogd(8) for more details
RSYSLOGD_OPTIONS=""

View File

@@ -1,5 +0,0 @@
# Default settings for openssh-server. This file is sourced by /bin/sh from
# /etc/init.d/ssh.
# Options to pass to sshd
SSHD_OPTS=

View File

@@ -1,22 +0,0 @@
# Defaults for TiMidity++ scripts
# sourced by /etc/init.d/timidity
# installed at /etc/default/timidity by the maintainer scripts
# $Id: timidity.default,v 1.3 2004/08/07 14:33:26 hmh Exp $
#
# This is a POSIX shell fragment
#
SERVER_HOME=/etc/timidity
SERVER_USER=timidity
SERVER_NAME="TiMidity++ MIDI sequencer service"
SERVER_GROUP=timidity
ADDGROUP=audio
# Enable MIDI sequencer (ALSA), if timidity-deamon is installed
# uncomment to override enabling triggered by availability of timidity-deamon
# TIM_ALSASEQ=false
# Setting overrides (of /etc/timidity.conf) for the ALSA sequencer daemon
TIM_ALSASEQPARAMS="-Os"

View File

@@ -1,17 +0,0 @@
# Defaults for triggerhappy initscript
# sourced by /etc/init.d/triggerhappy
# installed at /etc/default/triggerhappy by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Additional options that are passed to the Daemon.
DAEMON_OPTS=""
# The Triggerhappy daemon (thd) drops its root privileges after
# startup and becomes "nobody". If you want it to retain its root
# status (e.g. to run commands only accessible to the system user),
# uncomment the following line or specifiy the user option yourself:
#
# DAEMON_OPTS="--user root"

View File

@@ -1,37 +0,0 @@
# Default values for useradd(8)
#
# The SHELL variable specifies the default login shell on your
# system.
# Similar to DHSELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
SHELL=/bin/bash
#
# The default group for users
# 100=users on Debian systems
# Same as USERS_GID in adduser
# This argument is used when the -n flag is specified.
# The default behavior (when -n and -g are not specified) is to create a
# primary user group with the same name as the user being added to the
# system.
# GROUP=100
#
# The default home directory. Same as DHOME for adduser
# HOME=/home
#
# The number of days after a password expires until the account
# is permanently disabled
# INACTIVE=-1
#
# The default expire date
# EXPIRE=
#
# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
SKEL=/etc/skel
#
# Defines whether the mail spool should be created while
# creating the account
# CREATE_MAIL_SPOOL=yes

View File

@@ -1,59 +0,0 @@
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1
# fallback to static profile on eth0
#interface eth0
#fallback static_eth0
interface wlan0
static ip_address=192.168.1.1/24

View File

@@ -1,3 +0,0 @@
interface=wlan0
dhcp-range=192.168.1.10,192.168.1.100,255.255.255.0,24h
address=/terahz.site/192.168.1.1

View File

@@ -1,9 +0,0 @@
interface=wlan0
hw_mode=g
channel=8
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid=TeraHz
wpa_passphrase=terahertz

View File

@@ -1,146 +0,0 @@
#!/bin/sh
# Copyright (C) 2006-2009 Debian hostapd maintainers
# Faidon Liambotis <paravoid@debian.org>
# Kel Modderman <kel@otaku42.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# On Debian GNU/Linux systems, the text of the GPL license,
# version 2, can be found in /usr/share/common-licenses/GPL-2.
# quit if we're called for lo
if [ "$IFACE" = lo ]; then
exit 0
fi
if [ -n "$IF_HOSTAPD" ]; then
HOSTAPD_CONF="$IF_HOSTAPD"
else
exit 0
fi
HOSTAPD_BIN="/usr/sbin/hostapd"
HOSTAPD_PNAME="hostapd"
HOSTAPD_PIDFILE="/run/hostapd.$IFACE.pid"
HOSTAPD_OMIT_PIDFILE="/run/sendsigs.omit.d/hostapd.$IFACE.pid"
if [ ! -x "$HOSTAPD_BIN" ]; then
exit 0
fi
if [ "$VERBOSITY" = "1" ]; then
TO_NULL="/dev/stdout"
else
TO_NULL="/dev/null"
fi
hostapd_msg () {
case "$1" in
verbose)
shift
echo "$HOSTAPD_PNAME: $@" > "$TO_NULL"
;;
stderr)
shift
echo "$HOSTAPD_PNAME: $@" > /dev/stderr
;;
*)
;;
esac
}
test_hostapd_pidfile () {
if [ -n "$1" ] && [ -f "$2" ]; then
if start-stop-daemon --stop --quiet --signal 0 \
--exec "$1" --pidfile "$2"; then
return 0
else
rm -f "$2"
return 1
fi
else
return 1
fi
}
init_hostapd () {
HOSTAPD_OPTIONS="-B -P $HOSTAPD_PIDFILE $HOSTAPD_CONF"
HOSTAPD_MESSAGE="$HOSTAPD_BIN $HOSTAPD_OPTIONS"
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" && return 0
hostapd_msg verbose "$HOSTAPD_MESSAGE"
start-stop-daemon --start --oknodo --quiet --exec "$HOSTAPD_BIN" \
--pidfile "$HOSTAPD_PIDFILE" -- $HOSTAPD_OPTIONS > "$TO_NULL"
if [ "$?" -ne 0 ]; then
return "$?"
fi
HOSTAPD_PIDFILE_WAIT=0
until [ -s "$HOSTAPD_PIDFILE" ]; do
if [ "$HOSTAPD_PIDFILE_WAIT" -ge 5 ]; then
hostapd_msg stderr \
"timeout waiting for pid file creation"
return 1
fi
HOSTAPD_PIDFILE_WAIT=$(($HOSTAPD_PIDFILE_WAIT + 1))
sleep 1
done
cat "$HOSTAPD_PIDFILE" > "$HOSTAPD_OMIT_PIDFILE"
return 0
}
kill_hostapd () {
HOSTAPD_MESSAGE="stopping $HOSTAPD_PNAME via pidfile: $HOSTAPD_PIDFILE"
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" || return 0
hostapd_msg verbose "$HOSTAPD_MESSAGE"
start-stop-daemon --stop --oknodo --quiet --exec "$HOSTAPD_BIN" \
--pidfile "$HOSTAPD_PIDFILE" > "$TO_NULL"
[ "$HOSTAPD_OMIT_PIDFILE" ] && rm -f "$HOSTAPD_OMIT_PIDFILE"
}
case "$MODE" in
start)
case "$PHASE" in
pre-up)
init_hostapd || exit 1
;;
*)
hostapd_msg stderr "unknown phase: \"$PHASE\""
exit 1
;;
esac
;;
stop)
case "$PHASE" in
post-down)
kill_hostapd
;;
*)
hostapd_msg stderr "unknown phase: \"$PHASE\""
exit 1
;;
esac
;;
*)
hostapd_msg stderr "unknown mode: \"$MODE\""
exit 1
;;
esac
exit 0

View File

@@ -1,146 +0,0 @@
#!/bin/sh
# Copyright (C) 2006-2009 Debian hostapd maintainers
# Faidon Liambotis <paravoid@debian.org>
# Kel Modderman <kel@otaku42.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# On Debian GNU/Linux systems, the text of the GPL license,
# version 2, can be found in /usr/share/common-licenses/GPL-2.
# quit if we're called for lo
if [ "$IFACE" = lo ]; then
exit 0
fi
if [ -n "$IF_HOSTAPD" ]; then
HOSTAPD_CONF="$IF_HOSTAPD"
else
exit 0
fi
HOSTAPD_BIN="/usr/sbin/hostapd"
HOSTAPD_PNAME="hostapd"
HOSTAPD_PIDFILE="/run/hostapd.$IFACE.pid"
HOSTAPD_OMIT_PIDFILE="/run/sendsigs.omit.d/hostapd.$IFACE.pid"
if [ ! -x "$HOSTAPD_BIN" ]; then
exit 0
fi
if [ "$VERBOSITY" = "1" ]; then
TO_NULL="/dev/stdout"
else
TO_NULL="/dev/null"
fi
hostapd_msg () {
case "$1" in
verbose)
shift
echo "$HOSTAPD_PNAME: $@" > "$TO_NULL"
;;
stderr)
shift
echo "$HOSTAPD_PNAME: $@" > /dev/stderr
;;
*)
;;
esac
}
test_hostapd_pidfile () {
if [ -n "$1" ] && [ -f "$2" ]; then
if start-stop-daemon --stop --quiet --signal 0 \
--exec "$1" --pidfile "$2"; then
return 0
else
rm -f "$2"
return 1
fi
else
return 1
fi
}
init_hostapd () {
HOSTAPD_OPTIONS="-B -P $HOSTAPD_PIDFILE $HOSTAPD_CONF"
HOSTAPD_MESSAGE="$HOSTAPD_BIN $HOSTAPD_OPTIONS"
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" && return 0
hostapd_msg verbose "$HOSTAPD_MESSAGE"
start-stop-daemon --start --oknodo --quiet --exec "$HOSTAPD_BIN" \
--pidfile "$HOSTAPD_PIDFILE" -- $HOSTAPD_OPTIONS > "$TO_NULL"
if [ "$?" -ne 0 ]; then
return "$?"
fi
HOSTAPD_PIDFILE_WAIT=0
until [ -s "$HOSTAPD_PIDFILE" ]; do
if [ "$HOSTAPD_PIDFILE_WAIT" -ge 5 ]; then
hostapd_msg stderr \
"timeout waiting for pid file creation"
return 1
fi
HOSTAPD_PIDFILE_WAIT=$(($HOSTAPD_PIDFILE_WAIT + 1))
sleep 1
done
cat "$HOSTAPD_PIDFILE" > "$HOSTAPD_OMIT_PIDFILE"
return 0
}
kill_hostapd () {
HOSTAPD_MESSAGE="stopping $HOSTAPD_PNAME via pidfile: $HOSTAPD_PIDFILE"
test_hostapd_pidfile "$HOSTAPD_BIN" "$HOSTAPD_PIDFILE" || return 0
hostapd_msg verbose "$HOSTAPD_MESSAGE"
start-stop-daemon --stop --oknodo --quiet --exec "$HOSTAPD_BIN" \
--pidfile "$HOSTAPD_PIDFILE" > "$TO_NULL"
[ "$HOSTAPD_OMIT_PIDFILE" ] && rm -f "$HOSTAPD_OMIT_PIDFILE"
}
case "$MODE" in
start)
case "$PHASE" in
pre-up)
init_hostapd || exit 1
;;
*)
hostapd_msg stderr "unknown phase: \"$PHASE\""
exit 1
;;
esac
;;
stop)
case "$PHASE" in
post-down)
kill_hostapd
;;
*)
hostapd_msg stderr "unknown phase: \"$PHASE\""
exit 1
;;
esac
;;
*)
hostapd_msg stderr "unknown mode: \"$MODE\""
exit 1
;;
esac
exit 0

View File

@@ -1,25 +0,0 @@
# /usr/share/doc/lighttpd/authentication.txt.gz
server.modules += ( "mod_auth" )
# auth.backend = "plain"
# auth.backend.plain.userfile = "lighttpd.user"
# auth.backend.plain.groupfile = "lighttpd.group"
# auth.backend.ldap.hostname = "localhost"
# auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
# auth.backend.ldap.filter = "(uid=$)"
# auth.require = ( "/server-status" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "group=www|user=jan|host=192.168.2.10"
# ),
# "/server-info" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "group=www|user=jan|host=192.168.2.10"
# )
# )

View File

@@ -1,3 +0,0 @@
server.modules += ( "mod_accesslog" )
accesslog.filename = "/var/log/lighttpd/access.log"

View File

@@ -1,15 +0,0 @@
# /usr/share/doc/lighttpd/cgi.txt
server.modules += ( "mod_cgi" )
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}
## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.py even outside of /usr/lib/cgi-bin.
#
#cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".py" => "/usr/bin/python",
#)

View File

@@ -1,2 +0,0 @@
dir-listing.encoding = "utf-8"
server.dir-listing = "enable"

View File

@@ -1 +0,0 @@
server.modules += ( "mod_evasive" )

View File

@@ -1,5 +0,0 @@
# http://redmine.lighttpd.net/wiki/1/Docs:ModEVhost
server.modules += ( "mod_evhost" )
evhost.path-pattern = "/srv/%_/htdocs"

View File

@@ -1,3 +0,0 @@
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModExpire
server.modules += ( "mod_expire" )

View File

@@ -1,4 +0,0 @@
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
server.modules += ( "mod_fastcgi" )

View File

@@ -1 +0,0 @@
server.modules += ( "mod_flv_streaming" )

View File

@@ -1,3 +0,0 @@
$HTTP["host"] =~ "^www\.(.*)" {
url.redirect = ( "^/(.*)" => "http://%1/$1" )
}

View File

@@ -1,25 +0,0 @@
# /usr/share/doc/lighttpd/proxy.txt
server.modules += ( "mod_proxy" )
## Balance algorithm, possible values are: "hash", "round-robin" or "fair" (default)
# proxy.balance = "hash"
## Redirect all queries to files ending with ".php" to 192.168.0.101:80
#proxy.server = ( ".php" =>
# (
# ( "host" => "192.168.0.101",
# "port" => 80
# )
# )
# )
## Redirect all connections on www.example.com to 10.0.0.1{0,1,2,3}
#$HTTP["host"] == "www.example.com" {
# proxy.balance = "hash"
# proxy.server = ( "" => ( ( "host" => "10.0.0.10" ),
# ( "host" => "10.0.0.11" ),
# ( "host" => "10.0.0.12" ),
# ( "host" => "10.0.0.13" ) ) )
#}

View File

@@ -1,4 +0,0 @@
# /usr/share/doc/lighttpd/rewrite.txt
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ConfigurationOptions#mod_rewrite-rewriting
server.modules += ( "mod_rewrite" )

View File

@@ -1,10 +0,0 @@
# /usr/share/doc/lighttpd/rrdtool.txt
server.modules += ( "mod_rrdtool" )
## path to the rrdtool binary
rrdtool.binary = "/usr/bin/rrdtool"
## file to store the rrd database, will be created by lighttpd
rrdtool.db-name = "/var/www/lighttpd.rrd"

View File

@@ -1,11 +0,0 @@
# /usr/share/doc/lighttpd/simple-vhost.txt
server.modules += ( "mod_simple_vhost" )
## The document root of a virtual host is document-root =
## simple-vhost.server-root + $HTTP["host"] + simple-vhost.document-root
simple-vhost.server-root = "/srv"
simple-vhost.document-root = "htdocs"
## the default host if no host is sent
simple-vhost.default-host = "www.example.com"

View File

@@ -1,5 +0,0 @@
# /usr/share/doc/lighttpd/ssi.txt
server.modules += ( "mod_ssi" )
ssi.extension = ( ".shtml" )

View File

@@ -1,9 +0,0 @@
# /usr/share/doc/lighttpd/ssl.txt
$SERVER["socket"] == "0.0.0.0:443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/server.pem"
ssl.cipher-list = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
ssl.honor-cipher-order = "enable"
}

View File

@@ -1,15 +0,0 @@
# /usr/share/doc/lighttpd/status.txt
# http://trac.lighttpd.net/trac/wiki/Docs%3AModStatus
server.modules += ( "mod_status" )
# status.status-url = "/server-status"
# status.config-url = "/server-config"
## relative URL for a plain-text page containing the internal statistics
# status.statistics-url = "/server-statistics"
## add JavaScript which allows client-side sorting for the connection overview
## default: enable
# status.enable-sort = "disable"

View File

@@ -1,13 +0,0 @@
## The userdir module provides a simple way to link user-based directories into
## the global namespace of the webserver.
##
# /usr/share/doc/lighttpd/userdir.txt
server.modules += ( "mod_userdir" )
## the subdirectory of a user's home dir which should be accessible
## under http://$host/~$user
userdir.path = "public_html"
## The users whose home directories should not be accessible
userdir.exclude-user = ( "root", "postmaster" )

View File

@@ -1 +0,0 @@
server.modules += ( "mod_usertrack" )

View File

@@ -1,6 +0,0 @@
# -*- depends: accesslog -*-
server.modules += ( "mod_extforward" )
# extforward.headers = ("X-Cluster-Client-Ip")
# extforward.forwarder = ("10.0.0.232" => "trust")

View File

@@ -1,20 +0,0 @@
# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)

View File

@@ -1,15 +0,0 @@
#### handle Debian Policy Manual, Section 11.5. urls
## by default allow them only from localhost
$HTTP["remoteip"] =~ "^127\.0\.0\.1$|^::1$" {
alias.url += (
"/cgi-bin/" => "/usr/lib/cgi-bin/",
"/doc/" => "/usr/share/doc/",
"/images/" => "/usr/share/images/"
)
$HTTP["url"] =~ "^/doc/|^/images/" {
dir-listing.activate = "enable"
}
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( "" => "" )
}
}

View File

@@ -1 +0,0 @@
alias.url += ("/javascript" => "/usr/share/javascript")

View File

@@ -1,22 +0,0 @@
ligghttpd Configuration under Debian GNU/Linux
==============================================
Files and Directories in /etc/lighttpd:
---------------------------------------
lighttpd.conf:
main configuration file
conf-available/
This directory contains a series of .conf files. These files contain
configuration directives necessary to load and run webserver modules.
If you want to create your own files they names should be
build as nn-name.conf where "nn" is two digit number (number
is used to find order for loading files)
conf-enabled/
To actually enable a module for lighttpd, it is necessary to create a
symlink in this directory to the .conf file in conf-available/.
Enabling and disabling modules could be done by provided
/usr/sbin/lighty-enable-mod and /usr/sbin/lighty-disable-mod scripts.

View File

@@ -1 +0,0 @@
../conf-available/90-javascript-alias.conf

View File

@@ -1,27 +0,0 @@
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
)
server.document-root = "/home/terahz/TeraHz/frontend"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

View File

@@ -1,19 +0,0 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
cd /home/pi/TeraHz/backend
service lighttpd start
flask run -h 0.0.0.0 &
exit 0

View File

@@ -1,14 +0,0 @@
# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details
resolv_conf=/etc/resolv.conf
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
name_servers=1.1.1.1
# Mirror the Debian package defaults for the below resolvers
# so that resolvconf integrates seemlessly.
#dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
#pdnsd_conf=/etc/pdnsd.conf
#unbound_conf=/var/cache/unbound/resolvconf_resolvers.conf
resolvconf=NO

Binary file not shown.

6
flask-testing/hello1.py Normal file
View File

@@ -0,0 +1,6 @@
from flask import Flask
app = Flask(__name__)
@app.route('/<txt>')
def root(txt):
return 'txt={}'.format(txt)

14
frontend/FlaskModule.py Normal file
View File

@@ -0,0 +1,14 @@
from flask import Flask
app = Flask(__name__)
@app.route('/', methods = ['GET', 'POST'])
def index():
value = request.json['key']
return value
if __name__ == '__main__':
app.run
test = open("JsonJs", "r")
req = requests.post('C:/Users/Janez%20Dolzan/Documents/Python%20projects/Spektrometer/GitHub/TeraHz/frontend/website.html')

1
frontend/JsonJs.js Normal file
View File

@@ -0,0 +1 @@
var output = document.getElementById('output');

View File

@@ -1,56 +0,0 @@
// All code in this file is licensed under the ISC license, provided in LICENSE.txt
var globalObject;
$('#update').click(function () {
updateData();
});
// jQuery event binder
function updateData () {
// download data from backend into obj
const url = 'http://' + window.location.hostname + ':5000/data';
// I understand how bad this line looks. Please don't judge me...
$.get(url, function (data, status) { // standard jQuery AJAX
globalObject = data;
})
.done(function () {
fillTable(globalObject, $('#specter'));
graphSpectralData(globalObject, $('#spectrogram'));
fillLuxUv(globalObject, $('#luxuv'));
});
}
function fillTable (obj, dom) {
// applies data in obj[0] to HTML tags with the obj's key as ID.
// useful mostly for slapping spectrometer JSON into HTML tables.
for (var i in obj[0]) {
$(dom).find('#' + i).text(obj[0][i]);
}
}
function graphSpectralData (obj, dom) {
// graphs the data from obj[0] into canvas at dom
var arr = [];
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'R', 'I', 'S', 'J', 'T', 'U', 'V', 'W', 'K', 'L'].forEach(function (i) {
arr.push(obj[0][i]);
});
var chart = new Chart(dom, {
type: 'line',
data: {
labels: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'R', 'I', 'S', 'J', 'T', 'U', 'V', 'W', 'K', 'L'],
datasets: [{
label: 'Spectrometer data',
data: arr
}]
},
options: {
responsive: false
}
});
}
function fillLuxUv (obj, dom) {
$(dom).find('#lx').text(obj[1]);
$(dom).find('#uva').text(obj[2][0]);
$(dom).find('#uvb').text(obj[2][1]);
$(dom).find('#uvi').text(obj[2][2]);
}

View File

@@ -1,154 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<link rel="stylesheet" href="lib/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet.css">
<title>TeraHz</title>
</head>
<body>
<div class="container text-center">
<h1>TeraHz</h1>
</div>
<div class="container">
<button id="update" class="btn btn-primary m-1 float-right">Get data</button>
<p id="debug">
</p>
<h3>Spectrogram</h3>
<canvas id="spectrogram" width="640px" height="480"></canvas>
<h3>Spectral readings</h3>
<table class="table table-sm" id="specter">
<thead class="thead-dark">
<tr>
<th>Band</th>
<th>Wavelength [nm]</th>
<th>Irradiance [μW/cm²]</th>
</tr>
</thead>
<tr>
<td>A</td>
<td>410 nm</td>
<td id="A">---</td>
</tr>
<tr>
<td>B</td>
<td>435 nm</td>
<td id="B">---</td>
</tr>
<tr>
<td>C</td>
<td>460 nm</td>
<td id="C">---</td>
</tr>
<tr>
<td>D</td>
<td>485 nm</td>
<td id="D">---</td>
</tr>
<tr>
<td>E</td>
<td>510 nm</td>
<td id="E">---</td>
</tr>
<tr>
<td>F</td>
<td>535 nm</td>
<td id="F">---</td>
</tr>
<tr>
<td>G</td>
<td>560 nm</td>
<td id="G">---</td>
</tr>
<tr>
<td>H</td>
<td>585 nm</td>
<td id="H">---</td>
</tr>
<tr>
<td>R</td>
<td>610 nm</td>
<td id="R">---</td>
</tr>
<tr>
<td>I</td>
<td>645 nm</td>
<td id="I">---</td>
</tr>
<tr>
<td>S</td>
<td>680 nm</td>
<td id="S">---</td>
</tr>
<tr>
<td>J</td>
<td>705 nm</td>
<td id="J">---</td>
</tr>
<tr>
<td>T</td>
<td>730 nm</td>
<td id="T">---</td>
</tr>
<tr>
<td>U</td>
<td>760 nm</td>
<td id="U">---</td>
</tr>
<tr class="table-secondary">
<td>V</td>
<td>810 nm</td>
<td id="V">---</td>
</tr>
<tr class="table-secondary">
<td>W</td>
<td>860 nm</td>
<td id="W">---</td>
</tr>
<tr class="table-secondary">
<td>K</td>
<td>900 nm</td>
<td id="K">---</td>
</tr>
<tr class="table-secondary">
<td>L</td>
<td>940 nm</td>
<td id="L">---</td>
</tr>
</table>
<br>
<h3>Lux and UV readings</h3>
<table class="table" id="luxuv">
<thead class="thead-dark">
<tr>
<th>Parameter</th>
<th>Value</th>
</tr>
</thead>
<tr>
<td>Illuminance [lx]</td>
<td id="lx">---</td>
</tr>
<tr>
<td>UVA irradiance [μW/cm²]</td>
<td id="uva">---</td>
</tr>
<tr>
<td>UVB irradiance [μW/cm²]</td>
<td id="uvb">---</td>
</tr>
<tr>
<td>UVA/UVB average [μW/cm²]</td>
<td id="uvi">---</td>
</tr>
</table>
</div>
<script src="lib/bootstrap.bundle.min.js"></script>
<script src="lib/jquery-3.4.1.min.js"></script>
<script src="lib/chart.bundle.js"></script>
<script src="frontend.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More