Skip to content

Instantly share code, notes, and snippets.

View turnipsoup's full-sized avatar
🍎
Getting healthier

Jeremy Heckt turnipsoup

🍎
Getting healthier
View GitHub Profile
--
pl = {
sp_size=16,x=100,y=100,anim=false,sp=48,
fall=false,jump=false,jumping=false,
speed=1,gspeed=2,jspeed=1,jtick=8,
upblock=false,lblock=false,rblock=false
}
@turnipsoup
turnipsoup / quad-7-segment-shift.py
Created January 28, 2024 20:28
Scripts for controlling a quad 7-segment display via a Rasyberry Pi Pico using Micropython. Both Direct GPIO and via shift registers.
from machine import Pin
import time
import _thread
display_number = 0
padding = True
dataPIN1 = 18
dataPIN2 = 20
latchPIN2 = 19
@turnipsoup
turnipsoup / led_control.py
Last active January 11, 2024 19:01
Control RGB LED with MicroPython using PWM
from machine import Pin, PWM
from time import sleep
import random
pwm = PWM(Pin(15))
pwm2 = PWM(Pin(13))
pwm3 = PWM(Pin(11))
pwm.freq(1000)
pwm2.freq(1000)
@turnipsoup
turnipsoup / listify.py
Last active December 2, 2022 06:09
Take an input text file and have GPT-3 return a numbered list of action items
"""
Takes the passed text file and sends it to OpenAI GPT-3 to turn it into a To-Do list.
"""
import os, sys, openai
openai.api_key = os.getenv("OPENAI_API_KEY")
text = open(sys.argv[1], "r").read().strip()
@turnipsoup
turnipsoup / fixpgn.py
Created October 15, 2022 00:32
Fix PGNs that are broken by the MacOS Stockfish app
import sys
# Get first argument
filename = sys.argv[1]
# Open the file
pgn = open(filename, "r").read().strip()
# Split it into headers and moves
pgns = pgn.split("\n\n")
@turnipsoup
turnipsoup / get.ha
Last active April 27, 2022 19:03
Learning harelang - made a quit and easy DNS query tool for a single hostname.
use fmt;
use strings;
use net::dial;
use net::ip;
use strings;
use os;
export fn main() void = {
if (len(os::args) < 2) {
fmt::println("Usage: get <hostname>")!;
@turnipsoup
turnipsoup / .vimrc
Last active December 8, 2022 19:05
My vim confiug
" Basics
syntax enable
set expandtab
set splitbelow
set ruler
set scrolloff=3 " lines above/below cursor
set fileformats=unix,mac,dos
set cursorline
set autoread " automatically reloads file if changed outside
set splitbelow " split new window below current window
@turnipsoup
turnipsoup / robots_check.py
Last active December 10, 2021 04:31
Checks a robots.txt file and gets the status code for each endpoint present.
import requests, sys
def check_status_code(url, endpoint):
return requests.get(f'{url}{endpoint}').status_code
def check_endpoint(endpoint):
try:
print(endpoint, '->', check_status_code(target_url, endpoint))
except:
@turnipsoup
turnipsoup / red_pixels.go
Created August 16, 2021 01:18
Just learning Ebiten - will slowly fill every pixel in the window starting from the top left.
package main
import (
"image/color"
"log"
"github.com/hajimehoshi/ebiten/v2"
)
// Game implements ebiten.Game interface.
@turnipsoup
turnipsoup / ip_check.py
Created August 3, 2021 01:00
Checks your current IP against the last one, and alerts you in Discord if it changes.
import requests
import os.path
ip_address_file = "./last_ip_address.txt"
discord_webhook_url = "<webhook-url-goes-here>"
# Get current IP address from icanhazip
def get_current_ip() -> str:
r = requests.get("https://icanhazip.com")
return r.content.decode().strip()