Skip to content

Instantly share code, notes, and snippets.

Working from home

Jack Sweeney Jxck-S

Working from home
  • Student
  • Orlando Florida
View GitHub Profile
Jxck-S / nostr_relays.csv
Created May 12, 2023 19:26
A list of popular/free nostr relays that my plane-notify program can use for posting.
View nostr_relays.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Jxck-S /
Created May 9, 2023 01:18
Upload a file/image to AWS S3 bucket, meant for use with nostr for image hosting.
import boto3
def upload(file_name, bucket, aws_access_key, aws_access_key_sec):
s3 = boto3.client('s3', aws_access_key_id=aws_access_key, aws_secret_access_key=aws_access_key_sec)
s3.upload_file(file_name, bucket, file_name)
url = f"https://{bucket}{file_name}"
return url
Jxck-S /
Created May 9, 2023 01:16
Upload image/video to various nostr focused sharing platforms
def nostr_build_upload(file_name):
"""Uploads an image/video to nostr build and returns the URL of it."""
import requests
url = ''
with open(file_name, 'rb') as f:
files = {'fileToUpload': f}
data = {'submit': 'Upload'}
response =, files=files, data=data)
Jxck-S /
Created May 9, 2023 01:11
Flask file server, post or get files, requires api key for post. Can be used for nostr photo/video sharing.
from flask import Flask, request, send_from_directory
from werkzeug.utils import secure_filename
import os
import time
import threading
app = Flask(__name__)
# Set the upload folder and allowed extensions
app.config['UPLOAD_FOLDER'] = 'uploads'
Jxck-S /
Last active May 15, 2023 15:25
Post to nostr from Python, with helpful info on how to post a photo
import json
import ssl
import time
from nostr.event import Event
from nostr.relay_manager import RelayManager
from nostr.message_type import ClientMessageType
from nostr.key import PrivateKey
def nostr_post(note, private_key, image_url=None):
if image_url:
Jxck-S /
Created March 8, 2022 04:02
AAInflight Mini Status Program
import requests
import time
from geopy.distance import geodesic
last_coords = None
speed = None
time_btwn_change = 1
check_freq = 10
Jxck-S / aircraft_type_fuel_consumption_rate.json
Last active April 2, 2023 22:45
Fuel consumption rates by ICAO type of aircraft
View aircraft_type_fuel_consumption_rate.json
"EA50": {
"name": "Eclipse 550",
"galph": 76,
"category": "VLJ"
"LJ31": {
"name": "Learjet 31",
"galph": 202,
"category": "Light"
Jxck-S / acas.json
Created April 7, 2021 00:00
ADSBExchange ACAS List of JSONs of a single aircraft
View acas.json
{"hex":"abc515","type":"adsb_icao","flight":"ENY3725 ","r":"N858AE","t":"E135","alt_baro":11150,"alt_geom":11550,"gs":268.0,"track":44.24,"baro_rate":-1024,"squawk":"5237","emergency":"none","category":"A2","lat":32.660910,"lon":-97.306469,"nic":8,"rc":186,"seen_pos":0.3,"version":2,"nic_baro":1,"nac_p":9,"nac_v":1,"sil":3,"sil_type":"perhour","gva":2,"sda":2,"alert":0,"spi":0,"mlat":[],"tisb":[],"messages":45207249,"seen":0.0,"rssi":-6.4,"acas_ra":{"utc":"2021-04-05 00:07:16.0","unix_timestamp":1617581236.02,"df_type":17,"bytes":"E2C00006A9DFE4","ARA":"1100000","RAT":"0","MTE":"0","RAC":"0000","advisory_complement":"","advisory":"Level Off","TTI":"01","threat_id_hex":"aa77f9"}}
{"hex":"abc515","type":"adsb_icao","flight":"ENY3725 ","r":"N858AE","t":"E135","alt_baro":11125,"alt_geom":11525,"gs":268.0,"track":44.24,"baro_rate":-1088,"squawk":"5237","emergency":"none","category":"A2","lat":32.662354,"lon":-97.304787,"nic":8,"rc":186,"seen_pos":0.3,"version":2,"nic_baro":1,"nac_p":9,"nac_v":1,"sil":3,"sil_type":
Jxck-S /
Created March 8, 2021 01:17
Gets the closest airport from a coordinate using OpenFlights airports.dat
def get_closest_airport(latitude, longitude):
import csv
from geopy.distance import geodesic
plane = (latitude, longitude)
header = ["id", "name", "city", "country", "iata", "icao", "lat", "lng", "alt", "tz", "dst", "tz_db", "type", "source"]
with open('airports.dat', encoding='utf-8') as airport_dat:
airport_dat_reader = csv.DictReader(filter(lambda row: row[0]!='#', airport_dat), header)
for airport in airport_dat_reader:
airport_coord = float(airport['lat']), float(airport['lng'])
airport_dist = float((geodesic(plane, airport_coord).mi))
Jxck-S / ADSBXv1Response.json
Last active March 12, 2021 03:04
ADS-B Exchange v1 Single AC API Response / VRS Format
View ADSBXv1Response.json
"ac": [
"postime": "1615518192631",
"icao": "AA733B",
"reg": "N7723E",
"type": "B737",
"wtc": "2",
"spd": "426.8",
"altt": "0",