Skip to content

Instantly share code, notes, and snippets.

View anandharaj-dotworld's full-sized avatar

Anandharaj anandharaj-dotworld

View GitHub Profile
@anandharaj-dotworld
anandharaj-dotworld / gist:3f969a5e2fe1560037a68c69cf455eb0
Created August 15, 2023 17:05
Exploring Goroutines and Tickers in Go: A Deep Dive into Concurrency
// Write a sample code for goroutine with ticker
package main
import (
"fmt"
"time"
)
func main() {
@anandharaj-dotworld
anandharaj-dotworld / battery_darwin.go
Created January 28, 2023 08:40
Get Battery Information in darwin
package main
import (
"encoding/json"
"fmt"
"os/exec"
plist "howett.net/plist"
)
@anandharaj-dotworld
anandharaj-dotworld / adb-data-sheet.txt
Last active October 20, 2022 08:21
Basic adb commands
# connect adb over tcp
adb connect <ip>:<port>
# App install over adb
adb install package_name
# app install adb shell
adb shell pm install <app_path>
# app uninstall over adb
func kelvinToCelsius(temp uint32, n int) float64 {
// wmi return temperature Kelvin * 10, so need to divide the result by 10,
// and then minus 273.15 to get °Celsius.
t := float64(temp/10) - 273.15
n10 := math.Pow10(n)
return math.Trunc((t+0.5/n10)*n10) / n10
}