Skip to content

Instantly share code, notes, and snippets.

@ivanzamarro
ivanzamarro / logitech-ghub-fix-osx.md
Created October 2, 2023 08:08
Fix infinite loop of Logitech GHub on OSX

How to fix infinite loop of Logitech GHub on OSX

TL;DR: The Logitech GHub application faces an issue where it gets stuck in an infinite loop during initialization. The image provided illustrates this problem. Different attempted solutions include reinstalling and updating the application, which did not work. A working solution involves editing ~/.zshrc or ~/.bashrc using an OSX terminal and including specific aliases. After this, the user needs to manually reload the file and then kill and relaunch the application using terminal commands.

sudo pkill -i lghub; sleep 5; open /Applications/lghub.app
@davidnewhall
davidnewhall / pidfile_snippet.go
Last active July 26, 2024 13:17
How to write a PID file in Golang.
// Write a pid file, but first make sure it doesn't exist with a running pid.
func writePidFile(pidFile string) error {
// Read in the pid file as a slice of bytes.
if piddata, err := ioutil.ReadFile(pidFile); err == nil {
// Convert the file contents to an integer.
if pid, err := strconv.Atoi(string(piddata)); err == nil {
// Look for the pid in the process list.
if process, err := os.FindProcess(pid); err == nil {
// Send the process a signal zero kill.
if err := process.Signal(syscall.Signal(0)); err == nil {