Skip to content

Instantly share code, notes, and snippets.

View petrjahoda's full-sized avatar

Petr Jahoda petrjahoda

View GitHub Profile
@petrjahoda
petrjahoda / main.go
Last active August 29, 2021 13:03
socket-client
package main
import (
"bufio"
"fmt"
"net"
"strconv"
"sync"
"time"
)
global computerIsInUse, resetTime
on run
set computerIsInUse to true
set resetTime to (do shell script "date +%s") as integer
end run
on idle
set idleTime to (do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF; exit}'") as integer
if idleTime is greater than 7.4E+10 then
@petrjahoda
petrjahoda / create.sh
Last active April 29, 2022 07:35
script
name=${PWD##*/}
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o linux/amd64/"$name"
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o linux/arm64/"$name"
upx --best --lzma linux/amd64/"$name"
upx --best --lzma linux/arm64/"$name"
docker rmi -f petrjahoda/"$name":latest
docker buildx build -t petrjahoda/"$name":latest --platform=linux/arm64,linux/amd64 . --push
FROM scratch
ARG TARGETOS
ARG TARGETARCH
ADD /${TARGETOS}/${TARGETARCH} /
ENTRYPOINT ["/system_service"]
@petrjahoda
petrjahoda / go
Created October 1, 2023 07:10
read_data.go
var users []database.User
db.Find(&users)