Skip to content

Instantly share code, notes, and snippets.

@henri
Last active June 1, 2020 21:35
Show Gist options
  • Save henri/a0dee27cc2bffd23a3657e93449ffac0 to your computer and use it in GitHub Desktop.
Save henri/a0dee27cc2bffd23a3657e93449ffac0 to your computer and use it in GitHub Desktop.
Get QRBot WebServer Barcodes Output
#!/usr/bin/ruby
#
# RELEASED UNDER MIT LICENCE : https://mit-license.org
# Copyright Allrights Reserved 2020, Henri Shustak
#
# This is a script which is designed to be called to pull barcode data from a webserver. This specifically relates to QRBot iOS App.
# This is great if you use mobile phones or other barcode scannning devices to feed barcodes to a centalised webserver
#
# Released under MIT Licence
#
scan_server_url = "http://192.168.1.xxx:8000/scans/"
mydata = []
scans = `curl #{scan_server_url} 2> /dev/null | tr -d "[],:'(" | sed 's/unknown format//g' | sed 's/\Here are all the scans//g'`
individual_scans = scans.split(" )")
individual_scans.each do |s|
line = `echo '#{s}' | awk -F " " '{print $1}'`
if line.chomp != "" then
pushdata = `echo " #{line.chomp!}" | sed 's/^..//'`
mydata.push("#{pushdata.chomp!}")
end
end
mydata.each do |d|
puts "#{d}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment