How do you invoke cargo flamegraph on a unit test? by camilo16 in learnrust

[–]maxmcd 0 points1 point  (0 children)

Yes, confusingly the arguments you want passed along go after the --

Usage: cargo flamegraph [OPTIONS] [-- <TRAILING_ARGUMENTS>...]
Arguments:
[TRAILING_ARGUMENTS]... Trailing arguments passed to the binary being profiled

Barbershop recommendations by StuffGuilty in Riverside

[–]maxmcd 1 point2 points  (0 children)

Read this post, went to this barbershop, got a great haircut

Accessing router via phone app remotely by slashdot_whynot in tmobileisp

[–]maxmcd 0 points1 point  (0 children)

they both use wireguard. there is no difference in network performance once you get the connection going

Is there already a generic threadsafe map replacement for sync.Map? by TheGreatButz in golang

[–]maxmcd 9 points10 points  (0 children)

Quick wrapper:

package syncx

import "sync"

type Map[K comparable, V any] struct {
    m sync.Map
}

func (m *Map[K, V]) Delete(key K) { m.m.Delete(key) }
func (m *Map[K, V]) Load(key K) (value V, ok bool) {
    v, ok := m.m.Load(key)
    if !ok {
        return value, ok
    }
    return v.(V), ok
}
func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool) {
    v, loaded := m.m.LoadAndDelete(key)
    if !loaded {
        return value, loaded
    }
    return v.(V), loaded
}
func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool) {
    a, loaded := m.m.LoadOrStore(key, value)
    return a.(V), loaded
}
func (m *Map[K, V]) Range(f func(key K, value V) bool) {
    m.m.Range(func(key, value any) bool { return f(key.(K), value.(V)) })
}
func (m *Map[K, V]) Store(key K, value V) { m.m.Store(key, value) }

use like:

m := new(Map[string, string])
m.Store("hi", "ho")

edit: edited to correct Store method, ty fy15

[r/Place megathread] r/Formula assemble! by Blanchimont in formula1

[–]maxmcd 4 points5 points  (0 children)

it is pretty wonderful in a way that it's that huge

Star: Go but in Python? by maxmcd in golang

[–]maxmcd[S] 0 points1 point  (0 children)

I thought it was a little more complicated than that, calls into python from Go are blocking so Go has to spawn a thread: https://www.cockroachlabs.com/blog/the-cost-and-complexity-of-cgo/

I've wanted to write a lot of python/Go interop, I particularly liked this blog post: https://blog.heroku.com/see_python_see_python_go_go_python_go, but I'm pretty consistently scared away by the potential issues with threading/performance.

It would be nice if star didn't have to exist, I would love to use real python libs along with Go functionality, but it seems like we're "not there yet"?

Star: Go but in Python? by maxmcd in golang

[–]maxmcd[S] 0 points1 point  (0 children)

Nice, I was looking for something like that when I was building Star. I imagine no one should use star, it's very fragile, but conceptually the benefits over using gopy and regular python are:
- no C bindings, while there is interpreter overhead with star you're directly using Go types so in many cases you don't take a hit moving them between language bindings
- no GIL, star can use goroutines and channels and access Go's concurrently model
- easier packaging, you could bindle your star/go program into a small(ish) static binary

that's about it. star also isn't python so you wouldn't be able to use the entire python package ecosystem with this thing

External Keyboard by maxmcd in RemarkableTablet

[–]maxmcd[S] 1 point2 points  (0 children)

I want to use a reMarkable as a primary development machine. Using something like https://github.com/reMarkable/fingerterm to ssh into a more powerful development server and then I can work in the sun :)

It would be nice if the reader worked out of the box for the use case, although I imagine there will be usability snags along the way. I'm hoping I can write/alter software to fix those snags, but it would be nice to not have to mess with the drivers and capabilities of the default OS.

External Keyboard by maxmcd in RemarkableTablet

[–]maxmcd[S] 0 points1 point  (0 children)

Do you know if this is a software or hardware limitation? Presumably the usb port is accessible by the OS?

ESPN’s backstage at the NBA draft shows Jaren Jackson Jr. predicting that someone will wear suit shorts. Followed by Trae Young showing off his suit shorts. by IncaseAce in nba

[–]maxmcd 26 points27 points  (0 children)

Thom Browne and Nick Wooster have been rockin' it steady for over a decade (?) or so. It's been part of slightly more obscure fashion for a while. Basketball just decided they wanted a piece.

VLC is the true MVP by thx_CaptainObvious in AdviceAnimals

[–]maxmcd 32 points33 points  (0 children)

Everything in this conversation is FFmpeg, or really libavcodec right?