Skip to content

Instantly share code, notes, and snippets.

View tomeaton17's full-sized avatar

Tom Eaton tomeaton17

View GitHub Profile
[!] Server is down
[ ] Executing cron jobs
[ ] Cron jobs completed in 0 seconds
[ ] Waiting 86400 seconds
[ ] Running on Windows 6.2
[.] Reading configuration from file stunnel.conf
[.] UTF-8 byte order mark detected
[.] FIPS mode disabled
[ ] Compression disabled
[ ] Snagged 64 random bytes from C:/.rnd
@tomeaton17
tomeaton17 / stunnel.conf
Created February 6, 2017 18:59
openvpn over stunnel
cert = /etc/stunnel/stunnel.pem
pid = /var/run/stunnel.pid
output = /var/log/stunnel
[openvpn]
accept=443
connect=127.0.0.1:1194
@tomeaton17
tomeaton17 / lookuptable.h
Created January 17, 2017 16:40
Lookup table for Bourns encoder
/*
* This file decodes the output of a Bourns EAW0J-B24-AE0128L 8-bit Absolute Contacting Encoder.
* Index this table using the 8-bit value read from encoder, and the output is
* the position, from 0-127.
*
* Direction info: If position=0 corresponds with robot steerable-wheel pointing straight ahead,
* then position=1 is a tiny clockwise rotation of the steering wheel, i.e. robot is steering to
* the right when travelling forwards.
*
* Half the possible numbers aren't used. In the table these are set to 255 = x'FF'.
try:
exponent = len(self.lineEdit.text().split('.')[1])
rounded_answer = round(self.answer, exponent)
except:
divisor = math.floor(self.answer)
if len(str(divisor)) == 2:
divisor = 10
elif len(str(divisor)) == 3:
divisor = 100
rounded_answer = self.answer / divisor