Skip to content

Instantly share code, notes, and snippets.

View soypat's full-sized avatar
🎴

Patricio Whittingslow soypat

🎴
View GitHub Profile
@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
@soypat
soypat / _out.go
Created December 2, 2021 19:40
Interface documentation generation from methods.
package main
type Impl struct{}
func (Impl) X() {
}
type Xer interface{ X() } // X This is the xer implementation
// Second line
@soypat
soypat / helpers.go
Created September 3, 2021 02:27
Creating STL cylinders in go using sdfx
package helpers
import (
"github.com/deadsy/sdfx/sdf"
)
// Spaces sdf3's located at one point.
func DirectionalSpacing(shapes []sdf.SDF3, dir sdf.V3, baseSep float64) (spacings []sdf.V3) {
if dir.Equals(sdf.V3{}, 0) {
panic("direction must not be zero")
@soypat
soypat / fsnotify.go
Last active January 27, 2022 11:59
fsnotify tool
package main
import (
"context"
"fmt"
"io/fs"
stdlog "log"
"os"
"os/exec"
"os/signal"
@soypat
soypat / sub4section.cls
Created August 18, 2021 20:36
subsubsubsubsection for Latex
%----------------Lo de 4th layer de subsectrion
\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered
\titleformat{\subsubsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}