Skip to content

Instantly share code, notes, and snippets.

View wgaylord's full-sized avatar

William Gaylord wgaylord

View GitHub Profile
from objc_util import *
import time
import threading
C = ObjCClass
def take_photo_now(filename='photo.jpg'):
session = C('AVCaptureSession').new().autorelease()
session.sessionPreset = 'AVCaptureSessionPresetPhoto'
device = C('AVCaptureDevice').defaultDeviceWithMediaType_('vide')
device_input = C('AVCaptureDeviceInput').deviceInputWithDevice_error_(device, None)
import logging
import requests
import lxml.html
import sys
sat = "40014" #SAT norrad_cat_id
transmitter = "NSXo8tGxmxpTUMsmSH34FF" #Transmitter UUID
start="2017-12-1 17:00" #Start date and time
end="2017-12-2 03:00" #Stop date and time
import numpy as np
import pylab as plt
import ephem
import datetime
# Setup lat long of telescope
oxford = ephem.Observer()
oxford.lat =41.840
oxford.long = -87.640
oxford.date = datetime.datetime.now()
# Load Satellite TLE data.
import numpy as np
import pylab as plt
import ephem
import datetime
# Setup lat long of telescope
oxford = ephem.Observer()
oxford.lat =np.deg2rad(41.840)
oxford.long = np.deg2rad(-87.640)
oxford.date = ephem.Date('2018/01/01 11:33:00.00')
# Load Satellite TLE data.
Determining if the include file dlfcn.h exists failed with the following output:
Change Dir: C:/Users/chibi/Desktop/llvm-master/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin/ninja.exe" "cmTC_2961b"
[1/2] Building C object CMakeFiles/cmTC_2961b.dir/CheckIncludeFile.c.obj
FAILED: CMakeFiles/cmTC_2961b.dir/CheckIncludeFile.c.obj
C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\gcc.exe -o CMakeFiles/cmTC_2961b.dir/CheckIncludeFile.c.obj -c CheckIncludeFile.c
type_1_size_of = types["::u8"]["size_of"]
type_1_serialize = types["::u8"]["serialize"]
type_1_deserialize = types["::u8"]["deserialize"]
type_2_size_of = types["::u64"]["size_of"]
type_2_serialize = types["::u64"]["serialize"]
type_2_deserialize = types["::u64"]["deserialize"]
type_3_size_of = types["::f64"]["size_of"]
type_3_serialize = types["::f64"]["serialize"]
type_3_deserialize = types["::f64"]["deserialize"]
type_4_size_of = types["::sized_string"]["size_of"]
May 31 18:35:45 raspberrypi satnogs-client[4007]: 2018-05-31 18:35:45,024 - apscheduler.executors.default - INFO - Running job "spawn_observer (trigger: date[2018-05-31 18:
May 31 18:35:45 raspberrypi satnogs-client[4007]: 2018-05-31 18:35:45,093 - satnogsclient - ERROR - Cannot connect to socket 127.0.0.1:4533
May 31 18:35:45 raspberrypi satnogs-client[4007]: 2018-05-31 18:35:45,136 - satnogsclient - ERROR - Cannot connect to socket 127.0.0.1:4533
May 31 18:35:45 raspberrypi satnogs-client[4007]: Exception in thread Thread-2:
May 31 18:35:45 raspberrypi satnogs-client[4007]: Traceback (most recent call last):
May 31 18:35:45 raspberrypi satnogs-client[4007]: File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
May 31 18:35:45 raspberrypi satnogs-client[4007]: self.run()
May 31 18:35:45 raspberrypi satnogs-client[4007]: File "/usr/lib/python2.7/threading.py", line 754, in run
May 31 18:35:45 raspberrypi satnogs-client[4007]: self.__target(*self.__args, **self.__kwargs)
May 31 18:
fatal: [localhost]: FAILED! => {"attempts": 5, "changed": false, "cmd": "/var/lib/satnogs/bin/pip2 install git+https://gitlab.com/librespacefoundation/satnogs/satnogs-client.git@0", "msg": "stdout: Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple\nCollecting git+https://gitlab.com/librespacefoundation/satnogs/satnogs-client.git@0\n Cloning https://gitlab.com/librespacefoundation/satnogs/satnogs-client.git (to revision 0) to ./pip-req-build-ncXVaJ\nRequirement already satisfied: APScheduler in /var/lib/satnogs/lib/python2.7/site-packages (from satnogsclient==0.6.2+1.geb35d20) (3.5.1)\nRequirement already satisfied: SQLAlchemy in /var/lib/satnogs/lib/python2.7/site-packages (from satnogsclient==0.6.2+1.geb35d20) (1.2.8)\nRequirement already satisfied: requests in /var/lib/satnogs/lib/python2.7/site-packages (from satnogsclient==0.6.2+1.geb35d20) (2.18.4)\nRequirement already satisfied: validators in /var/lib/satnogs/lib/python2.7/site-packages (from satnogsclient==0.6.2+1.geb35d20)
So last year I wrote my own APRS tracker using Pythonista.
APRS stands for Automatic Packet Reporting System
Using a python library for it and pythonistas access to location and the internet I was able to write my own software to report into the system using my Call Sign and display my location of aprs.fi
The following is my code which I never really tided up at all.
```
import aprslib
import aprslib
import location
import time
from math import sin, cos, sqrt, atan2, radians
last = None
count = 0
location.start_updates()