Skip to content

Instantly share code, notes, and snippets.

View MrDMurray's full-sized avatar
😎
"On an intergalactic cruise... but he is in his office"

Daniel Murray MrDMurray

😎
"On an intergalactic cruise... but he is in his office"
View GitHub Profile
# Imports go at the top
# Send Code
from microbit import *
import radio
radio.config(group=23)
radio.on()
while True:
"""
from sense_hat import SenseHat github.com/STJRush
sense = SenseHat()
sense.clear()
temp = sense.get_temperature()
print(temp)
"""
#############################################################
from sense_hat import SenseHat
sense = SenseHat()
sense.set_rotation(270)
sense.show_message("Hi")
humidity = round( sense.get_humidity(), 1 )
sense.show_message( "Humidity now is " + str(humidity) +"%" )
@MrDMurray
MrDMurray / main.py
Created February 19, 2021 10:19
NKAstroPICode
# import the multiple libraries needed
from logzero import logger, logfile
from ephem import readtle, degree
from picamera import PiCamera
from datetime import datetime, timedelta
from time import sleep
from pathlib import Path
import csv
# directory to file
"""
## I've commented out the first part of this code as it's the last bit that does the writing to a .csv file. The first bit cleans it.
import csv
import re
#"valu" should be a string going into the function to get cleaned
def clean_stuff(valu):
@MrDMurray
MrDMurray / cleanstart.py
Created March 7, 2019 12:13
Practice Cleaning Data
#cleanstart
# xTitle yTitle x1 y1 x2 y2 x3 y3 etc...
dataListed = [['#Student', 'sCore.'], ['Mr. Joer', '2 points'], ['Lad John', 'Six'], ['Mr. Jimmy', '2%'], ['Legend James', '3.0'], ['Miss Jane', '4']]
@MrDMurray
MrDMurray / returns.py
Created February 28, 2019 10:56
Returning Functions Python Examples
#example 1
def make_foodz():
your_pasta=input("What kind of pasta would you like?")
print("Sure, I'll make you some delicous", your_pasta)
#return your_pasta
#program starts here
@MrDMurray
MrDMurray / windfromsounderrors.py
Created February 2, 2019 17:49
winsound errors
import winsound
#List of mistakes I have made using winsound:
########################################################################
# I hear nothing?
########################################################################
winsound.PlaySound("", winsound.SND_FILENAME)
#You hear nothing because you're missing your sound name
@MrDMurray
MrDMurray / travelingSalesmans.py
Created January 10, 2019 15:02
Traveling Salesman example for ALT3
import pandas
import tsp #traveling salesman
mat = [[ 0, 128, 75, 95],
[ 128, 0, 105, 160],
[ 75, 105, 0, 120],
[95, 160, 120, 0]] # Distance Matrix
r = range(len(mat))
# Dictionary of distance
dist = {(i, j): mat[i][j] for i in r for j in r}
@MrDMurray
MrDMurray / main.py
Created September 5, 2018 10:13
OldJoyfulMath created by MrDMurraySTJ - https://repl.it/@MrDMurraySTJ/OldJoyfulMath
from time import sleep
print ("Here is a wonderful tune for the lads and whamen")
sleep(1.5)
while True:
print("Death to America")
sleep(1.5)
print("And butter sauce")
sleep(1.5)
print("Don't boil me")