Skip to content

Instantly share code, notes, and snippets.

View DeadlySurgeon's full-sized avatar
💉

The Surgeon DeadlySurgeon

💉
View GitHub Profile
package main
import (
"errors"
"fmt"
)
func main() {
err := wrong()
fmt.Println(As[*Aerror](err))
@DeadlySurgeon
DeadlySurgeon / d.go
Last active November 29, 2024 23:37
Pipe Connector in Go
package pipedialer
import (
"context"
"net"
"sync"
)
type RotaryPhone struct {
connLock sync.Mutex
@DeadlySurgeon
DeadlySurgeon / unmarshal.go
Last active July 1, 2024 18:59
Regex based unmarshaler
package main
import (
"encoding"
"fmt"
"reflect"
"regexp"
"strconv"
)
@DeadlySurgeon
DeadlySurgeon / Square.go
Created February 3, 2024 05:07
Just a colorful square.
package main
import (
"context"
"fmt"
"os"
"os/signal"
"strings"
"time"
@DeadlySurgeon
DeadlySurgeon / Concurrency.md
Last active November 6, 2023 17:25
Go Concurrency Outline

Concurrency

This talk will go over concurrency with Go, and hopefully scratch the surface of how to write thread safe code as well as efficient worker delegation. We will be using the bult in sync package.

Goroutines

If you've worked with concurrency in other languages, you might be familiar with threading. In Go, we do not manage threads like we would in C or in Java.

@DeadlySurgeon
DeadlySurgeon / main.go
Last active July 24, 2023 02:58
Golang Terminal Percent Bar
package main
import (
"fmt"
"math"
"strings"
"time"
)
var (
@DeadlySurgeon
DeadlySurgeon / dice.go
Last active April 28, 2022 03:15
SVG Dice Generator for Fusion Project
package main
import (
"fmt"
"math"
"reflect"
"strings"
)
// COLORBLACK ...
@DeadlySurgeon
DeadlySurgeon / README.md
Last active March 9, 2022 19:51
POC language syntax

C

Verbal/VerbalScript (.vrbl)

This example bit of syntax can only be described as annoying. I've taken various aspects of different languages and picked out things I hate, and shoved them in. It is unlikely that I'll go far with this language, however I think that if I plan on learning LLVM and need a toy to hook up to it, this will be the syntax for that.

@DeadlySurgeon
DeadlySurgeon / README.md
Last active June 15, 2022 17:26
Reducer

Reducer

POC for effictively reducing a large data footprint.

A good canidate has been found for implementing our reducer function, however more tests should be done to push optimization, not that it is needed. Overall, with harsh benchmarking we expect to see 500~1000 ns/op (I know quite the range) depending on configuration and stack size.

More tests need to be performed though so we can determine the memory

{
"Profiles": [
{
"Link Color" : {
"Red Component" : 0.2919752080924809,
"Color Space" : "sRGB",
"Blue Component" : 0.958709716796875,
"Alpha Component" : 1,
"Green Component" : 0.61811793602673359
},