{"id":19721330,"url":"https://github.com/meinside/rpi-tools","last_synced_at":"2025-04-29T21:31:19.621Z","repository":{"id":57491055,"uuid":"83764274","full_name":"meinside/rpi-tools","owner":"meinside","description":"Go Tools for Raspberry Pi","archived":false,"fork":false,"pushed_at":"2022-03-02T08:57:22.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T19:51:09.511Z","etag":null,"topics":["golang","raspberry-pi"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meinside.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-03T06:12:47.000Z","updated_at":"2022-03-02T08:57:25.000Z","dependencies_parsed_at":"2022-08-29T20:31:56.013Z","dependency_job_id":null,"html_url":"https://github.com/meinside/rpi-tools","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meinside%2Frpi-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meinside%2Frpi-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meinside%2Frpi-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meinside%2Frpi-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meinside","download_url":"https://codeload.github.com/meinside/rpi-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251585801,"owners_count":21613280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","raspberry-pi"],"created_at":"2024-11-11T23:14:00.819Z","updated_at":"2025-04-29T21:31:14.613Z","avatar_url":"https://github.com/meinside.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpi-tools\n\nVarious tools for Raspberry Pi, written in Golang.\n\n## How to get\n\n```bash\n$ go get -u github.com/meinside/rpi-tools/...\n```\n\n## Usage (example)\n\n### Status\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/meinside/rpi-tools/status\"\n)\n\nfunc main() {\n\tprintStatuses1()\n\tprintStatuses2()\n}\n\nfunc printStatuses1() {\n\tif result, err := status.Hostname(); err == nil {\n\t\tfmt.Printf(\"\u003e hostname\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.Uname(); err == nil {\n\t\tfmt.Printf(\"\u003e uname\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.Uptime(); err == nil {\n\t\tfmt.Printf(\"\u003e uptime\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.FreeSpaces(); err == nil {\n\t\tfmt.Printf(\"\u003e free spaces\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.MemorySplit(); err == nil {\n\t\tfmt.Printf(\"\u003e memory split\\n%s\\n\\n\", strings.Join(result, \", \"))\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.FreeMemory(); err == nil {\n\t\tfmt.Printf(\"\u003e free memory\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.CpuTemperature(); err == nil {\n\t\tfmt.Printf(\"\u003e cpu temp\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n\n\tif result, err := status.CpuInfo(); err == nil {\n\t\tfmt.Printf(\"\u003e cpu info\\n%s\\n\\n\", result)\n\t} else {\n\t\tfmt.Printf(\"* error: %s\\n\", err)\n\t}\n}\n\nfunc printStatuses2() {\n\tsys, heap := status.MemoryUsage()\n\tfmt.Printf(\"\u003e memory usage\\nsystem: %.1fMB, heap: %.1fMB\\n\\n\",\n\t\tfloat32(sys)/1024/1024,\n\t\tfloat32(heap)/1024/1024,\n\t)\n\n\tips := status.IpAddresses()\n\tfmt.Printf(\"\u003e assigned ips\\n%s\\n\\n\", strings.Join(ips, \", \"))\n}\n```\n\nIt will print out:\n\n```\n\u003e hostname\nraspberry\n\n\u003e uname\nLinux raspberry 4.4.48-v7+ #964 SMP Mon Feb 13 16:57:51 GMT 2017 armv7l GNU/Linux\n\n\u003e uptime\n 15:06:05 up  5:03,  1 user,  load average: 0.30, 0.17, 0.11\n\n\u003e free spaces\nFilesystem      Size  Used Avail Use% Mounted on\n/dev/root        20G  4.4G   15G  24% /\ndevtmpfs        483M     0  483M   0% /dev\ntmpfs           487M  4.0K  487M   1% /dev/shm\ntmpfs           487M   19M  468M   4% /run\ntmpfs           5.0M  4.0K  5.0M   1% /run/lock\ntmpfs           487M     0  487M   0% /sys/fs/cgroup\n/dev/mmcblk0p1   60M   21M   39M  36% /boot\n/dev/sda3       438G  342G   74G  83% /home\n\n\u003e memory split\narm=992M, gpu=16M\n\n\u003e free memory\n             total       used       free     shared    buffers     cached\nMem:          973M       816M       156M        29M        80M       463M\nSwap:         1.1G         0B       1.1G\n\n\u003e cpu temp\ntemp=52.6'C\n\n\u003e cpu info\nprocessor       : 0\nmodel name      : ARMv7 Processor rev 4 (v7l)\nBogoMIPS        : 76.80\nFeatures        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32\nCPU implementer : 0x41\nCPU architecture: 7\nCPU variant     : 0x0\nCPU part        : 0xd03\nCPU revision    : 4\n\nprocessor       : 1\nmodel name      : ARMv7 Processor rev 4 (v7l)\nBogoMIPS        : 76.80\nFeatures        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32\nCPU implementer : 0x41\nCPU architecture: 7\nCPU variant     : 0x0\nCPU part        : 0xd03\nCPU revision    : 4\n\nprocessor       : 2\nmodel name      : ARMv7 Processor rev 4 (v7l)\nBogoMIPS        : 76.80\nFeatures        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32\nCPU implementer : 0x41\nCPU architecture: 7\nCPU variant     : 0x0\nCPU part        : 0xd03\nCPU revision    : 4\n\nprocessor       : 3\nmodel name      : ARMv7 Processor rev 4 (v7l)\nBogoMIPS        : 76.80\nFeatures        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32\nCPU implementer : 0x41\nCPU architecture: 7\nCPU variant     : 0x0\nCPU part        : 0xd03\nCPU revision    : 4\n\nHardware        : BCM2709\nRevision        : a02082\nSerial          : 0000000000000000\n\n\u003e memory usage\nsystem: 18.3MB, heap: 0.1MB\n\n\u003e assigned ips\n192.168.0.7\n\n```\n\n### Service (systemd)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/meinside/rpi-tools/service\"\n)\n\nfunc main() {\n\ttestSystemd()\n}\n\nfunc testSystemd() {\n\tvar msg string\n\tvar success bool\n\n\tvar statuses map[string]string\n\tstatuses, success = service.SystemctlStatus([]string{\"some-service1\", \"some-service2\"})\n\tfmt.Printf(\"\u003e service statuses:\\n\")\n\tfor service, status := range statuses {\n\t\tfmt.Printf(\"  %s: %s\\n\", service, status)\n\t}\n\n\tmsg, success = service.SystemctlStart(\"some-service3\")\n\tif success {\n\t\tfmt.Printf(\"\u003e %s\\n\", msg)\n\t} else {\n\t\tfmt.Printf(\"* %s\\n\", msg)\n\t}\n\n\tmsg, success = service.SystemctlStop(\"some-service3\")\n\tif success {\n\t\tfmt.Printf(\"\u003e %s\\n\", msg)\n\t} else {\n\t\tfmt.Printf(\"* %s\\n\", msg)\n\t}\n}\n```\n\n## Todos\n\n- [ ] Add some more useful functions\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeinside%2Frpi-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeinside%2Frpi-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeinside%2Frpi-tools/lists"}