Skip to content

Instantly share code, notes, and snippets.

View Leowbattle's full-sized avatar

Leo Battle Leowbattle

  • England
View GitHub Profile
#include <math.h>
#include <stdlib.h>
#include <raylib.h>
#include <raymath.h>
typedef struct Hermite {
float x;
float y;
float d;
} Hermite;
@Leowbattle
Leowbattle / pendulum.f90
Created September 9, 2023 11:23
Simulation of a simple pendulum in Fortran using the semi-implicit Euler method
program pendulum
implicit none
real :: time, dt, g, l, y, v
integer :: n, i
read (*,*) time, dt, g, l, y, v
n = ceiling(time / dt)
do i=2,n
@Leowbattle
Leowbattle / BVP.ipynb
Last active September 15, 2023 22:40
Boundary Value Problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Leowbattle
Leowbattle / Pico 7 Segment.py
Created March 29, 2024 21:44
Python script for Raspberry Pi Pico for displaying numbers on a 7-segment display. The number shown is incremented every time a button is pushed, and resets back to 0 when it goes above 9.
from machine import Pin
import utime
p = [Pin(i, Pin.OUT) for i in range(7)]
button = Pin(28, Pin.IN, Pin.PULL_DOWN)
digits = [
0b0111111,
0b0000110,
0b1011011,
@Leowbattle
Leowbattle / morse.py
Created April 7, 2024 15:03
Morse code transmitter for Raspberry Pi Pico
from machine import Pin
import utime
buzzer = Pin(16, Pin.OUT)
dit_time = 0.05
dah_time = dit_time * 3
message = "SOS WE ARE SINKING"
@Leowbattle
Leowbattle / gist:84fcefb41c10783bbfbd3b8524f9b15a
Last active August 29, 2024 12:52
Shader derivatives in Go
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func shader(id int, c chan int) {
x := id
c <- x
dx := <-c
function Item({ text, index, removeItem }) {
return (
<div className="todoitem">
<p>{text}</p>
<button onClick={e => removeItem(index)}>X</button>
</div>
);
}
function App() {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.