Skip to content

Instantly share code, notes, and snippets.

@km4ack
Forked from jdawgaz/gcs
Last active December 12, 2018 12:07
Show Gist options
  • Save km4ack/085e32da84476f0084fd6a5d34e1c675 to your computer and use it in GitHub Desktop.
Save km4ack/085e32da84476f0084fd6a5d34e1c675 to your computer and use it in GitHub Desktop.
js8call code
#!/usr/bin/env ruby
# Script to get callsign data
# usage: gcs callsign
#
# this ruby script uses nokogiri
# which must be installed:
# sudo gem install nokogiri
#
# prerequisite for nokogiri is ruby-dev
# install that by: sudo apt-get install ruby-dev
require 'open-uri'
require 'nokogiri'
baseurl = 'https://www.hamqth.com/'
cs = ARGV[0].upcase
url = baseurl + cs
printf "Callsign: %s\n", cs
def mkdata(tr)
itxt = tr.text
data = itxt.lstrip.rstrip.split(':')
end
doc = Nokogiri::HTML(open(url))
data = doc.css('tr')
data.each {|d|
case d.text
when /Name:/
data = mkdata(d)
printf "%-8s : %-20s\n", data[0], data[1]
when /QTH:/
data = mkdata(d)
printf "%-8s : %-20s\n", data[0], data[1]
when /State:/
data = mkdata(d)
printf "%-8s : %-20s\n", data[0], data[1]
when /Country:/
data = mkdata(d)
printf "%-8s : %-20s\n", data[0], data[1]
when /Grid:/
data = mkdata(d)
printf "%-8s : %-20s\n", data[0], data[1]
end
}
puts " "
puts "worked before (JS8):"
exec("awk -F, '{print $1, $5}' $HOME/.local/share/JS8Call/js8call.log | grep -i #{cs}")
#!/usr/bin/env bash
#Original script written by Jerry, K7AZJ and can be found at
#https://gist.github.com/jdawgaz/579e153535d27a79266688af9fd9c06c
#mod km4ack 20181212
# send aprs message to a callsign
# this uses the following format
# APRS::<callsign padded on the right side with spaces to 9>:message{sequence}
# the above string is sent via JS8Call via @ALLCALL
echo What is callsign message is going to? Include SSID
read cs
echo What is the message? Keep it brief.
read msg
echo What is the sequence number?
read seq
echo
echo Go to JS8Call to transmit the message when this window closes or completes.
sleep 2
echo
echo
value=$(printf '\"@ALLCALL APRS::%-9s:%s{%s}\"' ${cs} "${msg}" ${seq})
printf 'sending %s\n' "$value" # beware: can't use echo here
printf '{"params": {}, "type": "TX.SET_TEXT", "value": %s}\n' "${value}" | nc -l -u -w 10 2237
#!/usr/bin/env bash
#Original script written by Jerry, K7AZJ and can be found at
#https://gist.github.com/jdawgaz/579e153535d27a79266688af9fd9c06c
#mod km4ack 20181212
echo Who is the email to?
read addr
echo What is the email body?
read msg
echo What is the sequence number?
read seq
value="\"@ALLCALL APRS::EMAIL-2 :${addr} ${msg} {${seq}}\""
echo sending $value
echo
echo Go to JS8Call to transmit the message
echo after this window closes or completes.
echo
printf '{"params": {}, "type": "TX.SET_TEXT", "value": %s}\n' "${value}" | nc -l -u -w 10 2237
#!/usr/bin/env bash
#Original script written by Jerry, K7AZJ and can be found at
#https://gist.github.com/jdawgaz/579e153535d27a79266688af9fd9c06c
#mod km4ack 20181212
echo What is the phone number to text?
read phone
echo What do you want the text to say?
read msg
value="\"@ALLCALL APRS::SMSGTE :@${phone} ${msg}\""
echo sending $value
echo
echo Go to JS8Call to transmit
echo after this window closes or completes
echo
printf '{"params": {}, "type": "TX.SET_TEXT", "value": %s}\n' "${value}" | nc -l -u -w 10 2237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment