Skip to content

Instantly share code, notes, and snippets.

View Jxck-S's full-sized avatar
🏠
Working from home

Jack Sweeney Jxck-S

🏠
Working from home
  • Student
  • Orlando Florida
View GitHub Profile
@Jxck-S
Jxck-S / read_sensor_colored.py
Last active August 6, 2017 20:34 — forked from legotheboss/read_sensor.py
Python Script to Read Garage Sensor
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.IN)
while True:
if (GPIO.input(12) == True):
print('\x1b[1;37;42m' + 'Garage Door Closed' + '\x1b[0m')
else:
print('\x1b[1;37;43m' + 'Garage Door Open' + '\x1b[0m')
@Jxck-S
Jxck-S / Dash_accessory.js
Last active September 2, 2018 15:11
Dash_accessory.js
//START CONFIG
var dashMAC = "38:f7:3d:e3:98:46"; //enter your Amazon Dash Button mac ID here
var accessoryName = 'Gatorade Dash'; //enter what you want your Amazon Dash to be called in HomeKit
var uuidNAME = 'GADash'; //enter a singleword name here (use for UUID)
//END CONFIG
var Accessory = require('../').Accessory;
var Service = require('../').Service;
var Characteristic = require('../').Characteristic;
@Jxck-S
Jxck-S / outlet_accessory.js
Created September 3, 2018 19:22
outlet_accessory.js
// HomeKit types required
var request = require('request');
var types = require("./types.js");
var exports = module.exports = {};
exports.accessory = {
displayName: 'Weaved SmartPlug',
username: "C2:32:3F:EG:AE:F1",
pincode: "031-45-154",
services: [{
@Jxck-S
Jxck-S / fix.sh
Created January 24, 2020 00:52
fix perms
echo '
chmod -R 755 /bin /boot /dev /etc/ /home /lib /lib64 \
/media /mnt /opt /run /sbin /srv /usr /var
chmod -R 777 /initrd.img /vmlinuz
chmod -R 1777 /tmp
chmod -R 555 /sys
chmod -R 555 /proc
chmod -R 700 /root
@Jxck-S
Jxck-S / BlockGGDomains.txt
Last active February 3, 2020 01:28
Block Goguadrdian
@@||Goguadrdian.com
@Jxck-S
Jxck-S / PyDocu.py
Created October 11, 2020 00:25
Basic Python Examples
#Basic Print string
print ('something')
#Setting Variable
age = 25
#Print variable and string
print (age, 'add')
#basic input
age = input('Enter your age: ')
#convert variable to int or float
age_int = int(age)
@Jxck-S
Jxck-S / GoogleMapNearestAirport.py
Last active March 3, 2023 09:45
Lookup nearest airport from coordinates using Google Maps. Not a very good way much better options and better data.
#Scraped this for airports.dat from https://openflights.org/data.html use haversine formula to calculate distance from each airport, lowest is closest.
#Or use https://rapidapi.com/sujayvsarma/api/ourairport-data-search?endpoint=apiendpoint_157e1886-2798-46cf-83e6-b71c2cb76273 from https://ourairports.com/data/
import googlemaps
import json
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
def getAirport(rank_by, latitude, longitude):
nrby_key = config.get('GOOGLE', 'NEARBYSEARCHKEY')
@Jxck-S
Jxck-S / defAirportAPI.py
Last active October 26, 2020 02:37
Lookup Nearest API Wrapper/Function by cords using OutAirport API
#GET KEY AND HOST FROM https://rapidapi.com/sujayvsarma/api/ourairport-data-search?endpoint=apiendpoint_157e1886-2798-46cf-83e6-b71c2cb76273
def getAirport(latitude, longitude):
print(latitude, longitude)
import requests
import json
url = "https://ourairport-data-search.p.rapidapi.com/nearest/" + str(latitude) + "," + str(longitude)
querystring = {"maxResults":"1"}
headers = {
@Jxck-S
Jxck-S / ADSBXv2Response.json
Created December 24, 2020 04:15
Example Response of ADS-B Exchange v2 API
{
"ac": [
{
"hex": "a2fcf2",
"type": "adsb_icao",
"flight": "ASA541 ",
"r": "N292AK",
"t": "B739",
"alt_baro": 5400,
"alt_geom": 5650,
@Jxck-S
Jxck-S / ADSBXv1Response.json
Last active March 12, 2021 03:04
ADS-B Exchange v1 Single AC API Response / VRS Format
{
"ac": [
{
"postime": "1615518192631",
"icao": "AA733B",
"reg": "N7723E",
"type": "B737",
"wtc": "2",
"spd": "426.8",
"altt": "0",