Go Broadcast, one channel send to many goroutines channel recieve
package main
import (
"fmt"
"time"| package auth | |
| import ( | |
| "context" | |
| "encoding/json" | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "strings" |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| "math/rand" | |
| "os" | |
| "time" | |
| "github.com/gdamore/tcell/v2" |
| ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32d7", ATTR{idProduct}=="0001", TAG+="systemd", ENV{SYSTEMD_WANTS}="map-touchscreen.service" |
| // filepath: /<project folder>/main.go | |
| package main | |
| import ( | |
| "embed" | |
| "net/http" | |
| webview "github.com/webview/webview_go" | |
| ) |
| #SingleInstance | |
| #InstallKeybdHook | |
| #Persistent | |
| SetWorkingDir C:/ahk | |
| ; remap AJAZZ volume wheel to primary display brightness and screenshot on click | |
| ; remap to second display if shift is held | |
| ; original volume and pause mapping if Meta is held | |
| ; Temporarily disable Windows keys when other hotkeys are active |
| //! channel capacity monitoring for profiling | |
| func monitorChan[T any](ch chan T, name string) { | |
| chanMonitorInterval := time.Second | |
| for { | |
| // if len(ch) == cap(ch) { | |
| fmt.Printf("Channel: %s, Size: %d\n", name, len(ch)) | |
| // } | |
| time.Sleep(chanMonitorInterval) | |
| } | |
| } |
| package main | |
| import ( | |
| "bytes" | |
| "time" | |
| "os" | |
| "io/ioutil" | |
| "github.com/ebitengine/oto/v3" | |
| "github.com/youpy/go-wav" |
| package main | |
| import ( | |
| "bufio" | |
| "os" | |
| "fmt" | |
| // "foosoft.net/projects/jmdict" | |
| "git.foosoft.net/alex/jmdict" | |
| "encoding/json" | |
| ) |