A couple of scripts for publishing the state of an openwrt router to mqtt.
Relies on mosquitto_pub and mosquitto_sub being present
Init.d scripts including one to start a pair of file monitors and one to publish whether or not the router is onlien
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. | |
* | |
* The information contained herein is property of Nordic Semiconductor ASA. | |
* Terms and conditions of usage are described in detail in NORDIC | |
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. | |
* | |
* Licensees are granted free, non-transferable use of the information. NO | |
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from | |
* the file. | |
* |
#!/bin/ash | |
used=`top -n1 | grep -v grep | grep Mem | awk '{ print $2 }' | cut -d'K' -f 1` | |
free=`top -n1 | grep -v grep | grep Mem | awk '{ print $4 }' | cut -d'K' -f 1` | |
cat > /root/feed_update_payload.json <<EOF | |
{ | |
"version":"1.0.0", | |
"datastreams":[ | |
{"id":"used", |
#!/usr/bin/python | |
""" | |
Exploit for Samba vulnerabilty (CVE-2015-0240) by sleepya | |
The exploit only targets vulnerable x86 smbd <3.6.24 which 'creds' is controlled by | |
ReferentID field of PrimaryName (ServerName). That means '_talloc_zero()' | |
in libtalloc does not write a value on 'creds' address. | |
Reference: | |
- https://securityblog.redhat.com/2015/02/23/samba-vulnerability-cve-2015-0240/ |
#!/bin/bash | |
# Slightly modified version from https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh | |
# Run with sudo ./openvpn-install.sh and not sudo sh ./openvpn-install.sh as read command has issues with external triggering of scripts | |
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS | |
# This script will work on Debian, Ubuntu, CentOS and probably other distros | |
# of the same families, although no support is offered for them. It isn't | |
# bulletproof but it will probably work if you simply want to setup a VPN on | |
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and | |
# universal as possible. |
/* | |
You'll need the information below, get these after adding a device. I'm using the MAC address as the device's ID. | |
org=[org-id] | |
type=[device-type] | |
id=[device-id] | |
auth-method=token | |
auth-token=[auth-token] | |
*/ |
var request = require("request"); | |
var cheerio = require('cheerio'); | |
var $; | |
var post = function(form) { | |
request.post({ | |
followAllRedirects: true, | |
url: 'http://202.162.79.194/login/sz/hotspotlogin.php', | |
form: form |
// How to connect 5 publishers with 5 subscribers | |
// over TCP using ZeroMQ's XPUB/XSUB proxy. | |
// sub (connect) | |
// <-8701-> | |
// (bind) xpub <---> xsub (bind) | |
// <-8700-> | |
// (connect) pub | |
var zmq = require('zmq'); |
#install dependencies brew tap homebrew/dupes brew install binutils coreutils automake wget gawk libtool gperf gnu-sed --with-default-names grep export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
#prepare case-sensitive disk sudo hdiutil create ~/Documents/case-sensitive.dmg -volname "case-sensitive" -size 10g -fs "Case-sensitive HFS+" sudo hdiutil mount ~/Documents/case-sensitive.dmg
#create symbolic link to /esp8266
""" | |
This code computes pi. It's not the first python | |
pi computation tool that I've written. This program | |
is a good test of the mpi4py library, which is | |
essentially a python wrapper to the C MPI library. | |
To execute this code: | |
mpiexec -np NUMBER_OF_PROCESSES -f NODES_FILE python mpipypi.py |