This post will cover using an nginx server to conditionally proxy_pass to OpenHAB based on if the URL is being requested from the OpenHAB iOS App determined by the user agent of the request.
My setup has 3 machines of relevance:
Machine A hosts software known as BlueIris. This software records network enabled camera streams to disk, provides interfaces to review this footage, and can push alerts to iOS apps. This machine is not routable to the internet
Machine B is a Raspberry Pi 3 running OpenHAB 1.X. This machine is also not routable to the internet.
Machine C is a Raspberry Pi 3 with nginx acting as a proxy. It has an SSL certificate from LetsEncrypt. It is routable to the internet, having dual homes.
The desire is to route all traffic to Machine A, unless the request is coming from an application with the user agent containing "OpenHAB". This will be accomplished using "evil ifs". This method works for me, but your mileage may vary.
While discussing software test with a co-worker, we thought it would be interesting to see if we could automatically generate inputs to an arbitrary function to see if we can stimulate every branch and every conditional in an application.
Academic papers and commercial tools exist to do this, but I would like the experience of doing this myself. Additionally, furthering my understanding of programming language techniques, building a virtual machine, and working with Constraint Problem Solvers sounds very interesting.
There will be multiple steps to this process:
Define a simplified programming language to target.
Develop lexer/parser
Develop an interpreter/VM that can:
Evaluate a given function
Run test cases from a file
Provide Statement, MC/DC Coverage statistics
Display in a human readable format
Write a constraint solver. After sufficiently toiling with my custom constraint solver, use a open source constraint solver.
This post will cover Steps 1 and 2.
First, defining the language. The design factors for this language are:
Easy to write & parse
Limited types
boolean, uint32, int32, float32
Types can be expanded as needed, but we will start with a limited set.
Limited operators
'NOT', 'AND', 'OR', 'XOR', 'GT', 'LT', 'EQ'
Can also be expanded as needed.
No local variables
Support for this could be added, but for now we will skip it.
Limited control flow
Allow if/else
No loops (for, while). See below rule.
Recursion is allowed. See above rule.
With these limited requirements, a sample test script can be created:
This file contains hidden or 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
Using ANTLR4, a G4 grammar definition can also be created. I am relatively unfamiliar with this tool. I suspect the grammar could be cleaner, but this should be adequate for now. The executionStatement -> evaluationStatement -> operatorStatement part of the tree seemingly should be simplified to operatorStatement, but I don't know how to do this in ANTLR4, yet.
This file contains hidden or 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
Wanting to get rid of old hardware, I attempted to convert a Windows 7 x64 computer to a VMWare image. VMWare's P2V software would not convert my machine due to a GPT partition table. I manually converted my machine by doing the following after the break
This is covers the build and initial testing of my SoftRock SDR Ensemble RX 2. It is an extremely flexible low cost software defined radio. The purpose of buying and building this kit it to better understand the DSP involved in audio and radio applications.
There are tons of free SDR applications, but I'd like to write my own. It isn't my goal to write and distribute a professional SDR application, but to learn the DSP involved in software defined radio.
I absolutely want to implement single side band and AM. These modulations seem easy, and would allow me to listen to 'interesting' ham chatter.
Other than snooping on conspiracy theory chat, I really want to receive the WWV time broadcasts. There are a couple WWV transmitters in the frequencies that I can access, and the timecode modulation seems accessible.
It would be really cool to have my projects on PCBs instead of gigantic messes on my breadboard. The problem is at $99 a board getting them manufactured (in the US) is stupidly expensive. Making them at home looks reasonably cheap. I'd like to be able to do as small as 0603 parts at home, so lets see!