Skip to content

Instantly share code, notes, and snippets.

@misterhay
misterhay / open-in-jupyter-lite.js
Created February 1, 2024 22:31
Bookmarklet code to generate a URL for opening in Callysto JupyterLite
https://callysto.github.io/jupyterlite/lab/index.html?fromURL=https://raw.githubusercontent.com/PS43Foundation/data-dunkers/main/notebooks/python-continents-population.ipynb
@misterhay
misterhay / turtle-ds-hackathon.ipynb
Last active July 17, 2023 15:10
Notebook for a turtles and data science hackathon
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@misterhay
misterhay / network-scan.py
Last active July 11, 2023 16:28
Raspberry Pi Pico W SSID Scan
# https://dev.webonomic.nl/scanning-network-with-the-raspberry-pi-pico-w
import network
import binascii
wlan = network.WLAN() # network.WLAN(network.STA_IF)
wlan.active(True)
networks = wlan.scan() # list with tupples with 6 fields ssid, bssid, channel, RSSI, security, hidden
networks.sort(key=lambda x:x[3],reverse=True) # sorted on RSSI (3)
for i, w in enumerate(networks):
print(i, w[0].decode(), binascii.hexlify(w[1]).decode(), w[2], w[3], w[4], w[5])
@misterhay
misterhay / writefile-demo.ipynb
Created July 7, 2023 15:59
A notebook stub to demontrate writefile magic
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@misterhay
misterhay / Artificial-Intelligence-in-Core-Courses.ipynb
Last active May 1, 2023 23:34
Presentation: Artificial Intelligence in Core Courses
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@misterhay
misterhay / main.py
Created April 4, 2023 18:40
Micropython for datalogging with Raspberry Pi Pico W
from machine import Pin, ADC
import network
from time import sleep
import urequests as requests
led = Pin("LED", Pin.OUT)
led.on()
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
194 , 80 , 92
120 , 16 , 94
246 , 23 , 109
190 , 112 , 49
248 , 219 , 174
92 , 57 , 223
166 , 89 , 244
186 , 15 , 132
16 , 107 , 28
85 , 142 , 49
@misterhay
misterhay / log_ip.py
Created November 20, 2022 20:21
Logging IP address
import socket
from datetime import datetime
import requests
ip = socket.gethostbyname_ex(socket.gethostname())[-1]
ethercalc_id = 'iplog'
base_url = 'https://ethercalc.net/'
post_url = base_url+'_/'+ethercalc_id
@misterhay
misterhay / music-intro.ipynb
Created November 1, 2022 17:40
intro to music with Spotify
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@misterhay
misterhay / RockPaperScissors.java
Created October 8, 2022 16:59
Basic One-Player Rock, Paper, Scissors in Java
import java.util.Scanner;
import java.util.Arrays;
public class RockPaperScissors
{
public static void RockPaperScissors()
{
String[] possibleChoices = {"rock", "paper", "scissors"};
Scanner userInput = new Scanner(System.in); // create a Scanner for getting user input
String playerChoice = ""; // declare an empty variable that we'll fill with the user input