Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenneth Finnegan PhirePhly

View GitHub Profile
@PhirePhly
PhirePhly / YTChanViewCounter.ino
Created Jun 25, 2017
YouTube API to MAX7219 display Widget
View YTChanViewCounter.ino
// YouTube Channel View Counter
// Kenneth Finnegan, 2017
//
// Given a WiFi SSID + password, and YouTube API key + channel ID, displays the
// current total views count on an attached MAX7219 eight digit display
#include <YoutubeApi.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
View gist:a5410b767cf4b1d8a690c95aaeedc791
10 APRX
1 APRX08
1 APRX16
4 APRX18
1 APRX1C
1 APRX1D
2 APRX1E
3 APRX1L
3 APRX1M
5 APRX2
@PhirePhly
PhirePhly / aprx.conf.kd0yuj
Created Nov 6, 2016
KD0YUJ configs for diagnostics
View aprx.conf.kd0yuj
mycall KD0YUJ #This is my call sign
myloc lat 3927.93N lon 09418.34W #Location of my digi-gate
<aprsis>
passcode ***** #passcode for APRS-IS
server rotate.aprs.net 14580 #APRS-IS Server and Port
filter r/39.46550/-94.30566/80.4672 #grab within 50 mile radius of station from APRS-IS
filter b/EAX* #grab WX bulletins-objects NWS Pleasant Hill office
</aprsis>
<logging>
pidfile /var/run/aprx.pid #default
@PhirePhly
PhirePhly / dayofweek.c
Created Oct 14, 2016
Calculate the local day of the week from Unix time and time zone offset
View dayofweek.c
#include <stdio.h>
#include <time.h>
// Calculate the current day of the week as an integer
// now - Unix timestamp like that from time(NULL)
// tz_offset - Number of hours off from UTC; i.e. PST = -8
// Return value: Sunday=0, Monday=1, ... Saturday=6
int dayofweek(time_t now, int tz_offset) {
// Calculate number of seconds since midnight 1 Jan 1970 local time
time_t localtime = now + (tz_offset * 60 * 60);
View mqtt_led_client.py
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
def on_connect(client, userdata, rc):
#print ("Connected with rc: " + str(rc))
client.subscribe("kwf/demo/led")
def on_message(client, userdata, msg):
View RPiLEDDemo.py
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
def on_connect(client, userdata, rc):
print ("Connected with rc: " + str(rc))
client.subscribe("kwf/demo/led")
def on_message(client, userdata, msg):
print ("Topic: "+ msg.topic+"\nMessage: "+str(msg.payload))
if "green" in msg.payload:
@PhirePhly
PhirePhly / beacon_and_remove.sh
Created Aug 22, 2015
Short exec file for APRX to wrap a beacon file to delete it upon beaconing
View beacon_and_remove.sh
#!/bin/bash
BEACONFILE="./beaconfile.txt"
if [ -f $BEACONFILE ]; then
cat ./beaconfile.txt
rm ./beaconfile.txt
fi
@PhirePhly
PhirePhly / gist:0a6cc9451c51e4cc09d3
Created Apr 20, 2015
APRS-IS Client Keep-alive behavior
View gist:0a6cc9451c51e4cc09d3
Client to server keep-alives should not be sent more often than once every
20 seconds, unless intra-connection meta-data is being conveyed inside the
'# ...' keep-alive line. It is suggested that clients send a keep-alive line
at least once every 24h, with typical rates in the 10m-1h range. Client to
server keep-alives are purely optional; servers may instead choose to
implement client time-out based on their L4 TCP behavior, and clients may
instead choose to tolerate being periodically dropped from the server as an
inactive connection.
View gist:1bec79a16760a2cefdce
kenneth@thor:~$ snmpwalk -v 1 -c public 10.44.1.30
SNMPv2-MIB::sysDescr.0 = STRING: APC Web/SNMP Management Card (MB:v3.2.0 PF:v3.2.1 PN:aos321.bin AF1:v2.0.1 AN1:em201.bin MN: AP9312TH HR: J13 SN: JA0302010295 MD: 01/06/2003) (Embedded PowerNet SNMP Agent SW v2.2 compatible)
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.318.1.3.8.1
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (27570) 0:04:35.70
SNMPv2-MIB::sysContact.0 = STRING: Kenneth Finnegan
SNMPv2-MIB::sysName.0 = STRING: KWFAPC1
SNMPv2-MIB::sysLocation.0 = STRING: lan.thelifeofkenneth.com
SNMPv2-MIB::sysServices.0 = INTEGER: 72
IF-MIB::ifNumber.0 = INTEGER: 1
IF-MIB::ifIndex.1 = INTEGER: 1
View gist:536151a66c609a324403
// ADD THIS TO ttyreader.c at line 318
FILE *rflogfd;
char hackbuf[1024];
sprintf(hackbuf, "/var/log/aprx/kiss.%d.log", S->fd);
rflogfd = fopen(hackbuf, "a");
hexdumpfp(rflogfd, S->rdbuf+S->rdlen, i, 1);
fprintf(rflogfd, "\n");
fclose(rflogfd);