Skip to content

Instantly share code, notes, and snippets.

# define our method
def replace_all(text, dic):
for i, j in dic.iteritems():
text = text.replace(i, j)
return text
navtex = 'navtex string here'
# our dictionary with our key:values.
dic = {'BACK':'Backing','KMH':'Km/h','QUAD':'Quadrant','BECMG':'Becoming','KT':'Knots','RPDY':'Rapidly','BLDN':'Building','LAT/LONG':'Latitude/Longitude','SCT':'Scattered','C-FRONT':'Cold front','LOC':'Locally','SEV':'Severe','SVR':'Severe','DECR':'Decreasing','M':'Metres','SHWRS':'Showeres','SH':'showers','DPN':'Deepening','MET':'Meteo','SIG':'Significant','EXP':'Expected,''MOD':'Moderate','SLGT':'slight','SLT':'Slight','FCST':'Forecsat','MOV':'moving/move','MVG':'Moving/Move','SLWY':'Slowly','FLN':'Filling','NC':'No change','STNR':'Stationary','FLW':'Following','NM':'Nautical miles','STRG':'Strong','FM':'From','NOSIG':'No significant change','TEMPO':'Temporarily/Temporary','FRQ':'Frequent/frequency','NXT':'Next','TEND':'Further Outlooks','HPA':'HectoPascal','OCNL':'Ocasionally','VEER':'Veering','HVY':'Heavy'
@hsiboy
hsiboy / radio4.sh
Created September 7, 2018 13:37
Record Radio4 FM from Winter Hill. to record Shipping Forecast.
#!/bin/bash
# Record radio4 FM from Winter Hill.
# To be triggered by cron to record Shipping Forecast.
# "timeout" will send a SIGTERM to rtl_fm to abort the recording after 5 mins.
# Afterwards the wav file is converted to 11025 sample rate using sox.
# "touch" will transfer the original timestamp to the new file
# the original rtl_fm wav-file is deleted.
timeout -s SIGTERM 300s rtl_fm -M wbfm -f 93M -s 60k -g 20 -E wav -F 0 radio4fm.wav
@hsiboy
hsiboy / NASA_Marine_navtex.txt
Last active June 4, 2021 19:50
Interface Specification for NASA Marine PC Navtex Pro
Interface Specification for NASA Marine PC Navtex Pro
1 - Electronic Interface
Power input: +10Volts to + 16Volts.
RS232 interface:
data format: 8 bits, 1 start bit, no parity, 1 stop bit.
Connector: 9-pin D-type socket mounted on the board.
pin 2: 38,400 Baud output from Engine to PC
pin 3: 38,400 Baud input to Engine from PC
@hsiboy
hsiboy / direwolf_install.sh
Created August 26, 2018 11:02
Installing direwolf for an iGate on fresh raspberry pi
# assumes rtl sdr is installed
cd ~
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libasound2-dev cmake build-essential libusb-1.0-0-dev
git clone https://www.github.com/wb2osz/direwolf
cd direwolf
make
sudo make install
make install-conf
@hsiboy
hsiboy / gpsd.sh
Created July 20, 2018 10:28
Adding GPS to Raspberry Pi running PiAware / Dump1090 for ADS-B Flight Tracking
sudo apt-get install -y gpsd
sudo apt-get install -y gpsd-clients
sudo apt-get install -y python-gps
sudo apt-get install -y libcap-dev
sudo apt-get install -y pps-tools
echo console=ttyACM0,115200 >> /boot/cmdline.txt
# edit /etc/rc/local and add (before the exit 0)
# sudo gpsd /dev/ttyACM0 -F /var/run/gpsd.sock
@hsiboy
hsiboy / watchdog.sh
Created July 18, 2018 16:47
Install watchdog service on raspberry pi - restart raspberry pi if x
# install the service
sudo modprobe bcm2708_wdog
echo "bcm2708_wdog" | sudo tee -a /etc/modules
sudo apt-get install watchdog
sudo update-rc.d watchdog defaults
# configure service
sudo vi /etc/watchdog.conf
# Uncomment the line that starts #watchdog-device to enable the watchdog daemon to use the watchdog device.
@hsiboy
hsiboy / install_sdr.sh
Created July 13, 2018 12:48
script to install rtl_sdr on fresh raspberry pi.
cd ~
sudo raspi-config --expand-rootfs
sudo apt-get update
sudo apt-get upgrade
cat <<EOF >no-rtl.conf
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830
EOF
sudo mv no-rtl.conf /etc/modprobe.d/
@hsiboy
hsiboy / locate.sh
Created July 13, 2018 10:51
Used to locate a Raspberry PI via flashing on-board LED
#!/bin/bash
if [[ $UID -ne 0 ]]; then
echo "This script must be run as root."
exit 100
fi
# decativate the mmc0 trigger
echo none >/sys/class/leds/led0/trigger
modprobe ledtrig_timer

Keybase proof

I hereby claim:

  • I am hsiboy on github.
  • I am stuarttaylor (https://keybase.io/stuarttaylor) on keybase.
  • I have a public key ASARxl6QyjoM_130xs1VjVfVZ47blsbzLOUIHz2t4-SFUAo

To claim this, I am signing this object:

@hsiboy
hsiboy / ENC28J60.md
Created February 6, 2018 19:55
Connecting an ENC28J60 module to a STM32F103
 
ENC28J60  STM32F103
SCK        PA5
SO         PA6
SI         PA7
CS         PA4
RST        PA0
 
VCC - 5V