Skip to content

Instantly share code, notes, and snippets.

View soypat's full-sized avatar
🎴

Patricio Whittingslow soypat

🎴
View GitHub Profile
@soypat
soypat / gitfetchpr.sh
Created July 2, 2025 17:18
git add remote PR to your repo and work on it or test it.
# Example PR https://github.com/soypat/glay/pull/2
NAME=amken
REMOTE_BRANCH=main # The branch the PR was created on the remote repo.
git remote add $NAME [email protected]:amken3d/glay.git
git fetch $NAME # Get latest branch state.
git checkout $NAME/$REMOTE_BRANCH # pull changes in detached state, we will not track remote
git switch -c $NAME-here # we create a new branch to work on changes, but in our repo.
@soypat
soypat / jeska2.go
Last active June 10, 2025 17:25
Generalized circle midpoint algorithm adapted for drawing multiple shapes
package main
import (
"image"
"image/color"
"image/png"
"os"
)
func main() {
@soypat
soypat / jeska.go
Created June 10, 2025 14:54
Midpoint circle algorithm using Jeska's algorithm
package jeska
import (
"image"
"image/color"
)
func CircleOutline(img *image.RGBA, r int, c color.RGBA) {
t1 := r / 16 // Nicer looking circle when initialized.
x := r
@soypat
soypat / rp2350_boot2_generic03h.S
Created November 25, 2024 21:58
Raspberry Pi Pico 2350 self contained second stage bootloader
// ----------------------------------------------------------------------------
// Second stage boot code
// Copyright (c) 2019-2021 Raspberry Pi (Trading) Ltd.
// SPDX-License-Identifier: BSD-3-Clause
//
// Device: Anything which responds to 03h serial read command
//
// Details: * Configure SSI to translate each APB read into a 03h command
// * 8 command clocks, 24 address clocks and 32 data clocks
// * This enables you to boot from almost anything: you can pretty
@soypat
soypat / gen_test.go
Created August 17, 2024 19:48
ODB++ system attributes code generation from PDF copy pasted table p 215..270
package odb2p
import (
_ "embed"
"fmt"
"os"
"strings"
"testing"
)
@soypat
soypat / tap.go
Created March 3, 2024 21:54
Unix TAP example using /x/sys library
package main
import (
"errors"
"log"
"net/netip"
"os"
"unsafe"
"golang.org/x/sys/unix"
@soypat
soypat / sets.go
Last active December 11, 2022 20:13
Set operations for Go.
package sets
// a | b
func union[T comparable](a, b map[T]struct{}) map[T]struct{} {
c := make(map[T]struct{})
for k := range a {
c[k] = struct{}{}
}
for k := range b {
c[k] = struct{}{}
@soypat
soypat / article.go
Last active April 18, 2022 21:14
Get SYC component data using a web scraper
package main
import (
"fmt"
"log"
"strconv"
"strings"
wd "github.com/fedesog/webdriver"
)
@soypat
soypat / settings.yaml
Last active January 19, 2022 15:20
Visual Studio Code settings.json for Golang. Semantic highlighting+namespace coloring.
{
// Font
"editor.fontFamily": "JetBrains Mono NL", // Install font first.
"editor.fontLigatures": false,
// Editor
"workbench.sideBar.location": "right",
"explorer.confirmDelete": false,
"window.zoomLevel": 2,
"files.associations": {
@soypat
soypat / dgemmCornerCase.f90
Last active December 21, 2021 16:52
Dgemm vector->matrix LAPACK translation corner case.
! To compile program with LAPACK:
! gfortran main.f90 -L/home/pato/src/lia/lapack -llapack -lrefblas
program main
implicit none
integer, parameter :: is=2, js=2, nb=2,mb=2
double precision :: one, rhs(8)
integer, parameter :: m=4, n=4 ! constants for test.
integer, parameter :: lda=m, ldb=n, ldc=m, ldd=m, lde=n, ldf=m ! expected leading dimensions