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
# /etc/freeradius/mods-enabled/rest | |
rest { | |
# | |
# This subsection configures the tls related items | |
# that control how FreeRADIUS connects to a HTTPS | |
# server. | |
# | |
tls { | |
# ca_file = ${certdir}/cacert.pem |
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
#!/usr/bin/env lua | |
-- retrieve monitoring information | |
-- and return it as NetJSON Output | |
ubus_lib = require('ubus') | |
cjson = require('cjson') | |
-- takes ubus wireless.status clients output and converts it to NetJSON | |
function netjson_clients(clients) | |
local data = {} | |
for mac_address, properties in pairs(clients) do |
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
def find_monthly_interest(minimum, maximum, interest, find_round=False): | |
interest = interest / 100.0 | |
counter = minimum | |
while counter <= maximum: | |
amount = counter | |
counter += 1 | |
monthly = amount * interest / 12 | |
if find_round and amount * interest % 12.0 != 0: | |
continue | |
print('{0} yelds {1} per month'.format(amount, monthly)) |
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
{ | |
"files": [ | |
{ | |
"path": "/usr/sbin/openwisp-monitoring", | |
"mode": "0744", | |
"contents": "uuid=$(uci get openwisp.http.uuid)\nkey=$(uci get openwisp.http.key)\nbase_url=$(uci get openwisp.http.url)\nverify_ssl=$(uci get openwisp.http.verify_ssl)\nincluded_interfaces=$(uci get openwisp.monitoring.included_interfaces)\nurl=\"$base_url/api/v1/monitoring/device/$uuid/?key=$key\"\ndata=$(/usr/sbin/netjson-monitoring \"$included_interfaces\")\nif [ \"$verify_ssl\" = 0 ]; then\n curl_command='curl -k'\nelse\n curl_command='curl'\nfi\n# send data via POST\n$curl_command -H \"Content-Type: application/json\" \\\n -X POST \\\n -d \"$data\" \\\n -v $url\n" | |
}, | |
{ | |
"path": "/usr/sbin/netjson-monitoring", | |
"mode": "0744", |
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
def avg_position(positions): | |
assert type(positions) in (list, tuple) | |
total_value = 0 | |
total_quantity = 0 | |
for position in positions: | |
quantity, price = position | |
total_quantity += quantity | |
total_value += quantity / price | |
return total_quantity / total_value |
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
import codecs | |
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey | |
from cryptography.hazmat.primitives import serialization | |
# generate private key | |
private_key = X25519PrivateKey.generate() | |
bytes_ = private_key.private_bytes( | |
encoding=serialization.Encoding.Raw, | |
format=serialization.PrivateFormat.Raw, | |
encryption_algorithm=serialization.NoEncryption() |
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
#!/bin/sh | |
reboot=false | |
# updates opkg lists only if necessary | |
opkg_update(){ | |
( | |
test -d /tmp/opkg-lists/ && \ | |
test -f /tmp/opkg-lists/openwrt_base && \ | |
test -f /tmp/opkg-lists/openwrt_packages && \ | |
test -f /tmp/opkg-lists/openwrt_core |
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
#!/usr/bin/env python | |
from openwisp2.celery import app | |
import os | |
import sys | |
import django | |
import time | |
from django.conf import settings | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'openwisp2.settings') |
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
# this conf allows to connect an OpenWrt device to any WiFi WPA2/3 network which has internet connection | |
# then allows to connect other routers / devices to the LAN switch of the OpenWrt router or to its WiFi AP. | |
# The traffic is NATted. | |
# /etc/config/network | |
config interface 'lan' | |
option type 'bridge' | |
option ifname '<INTERFACES OF BR-LAN HERE>' | |
option ip6assign '60' |
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
firewall: | |
config rule | |
option name 'Allow DHCP from LAN' | |
option src 'lan' | |
#option dest 'lan' | |
option proto 'udp' | |
option dest_port '67' | |
option target 'ACCEPT' | |
OlderNewer