Skip to content

Instantly share code, notes, and snippets.

View KEINOS's full-sized avatar

KEINOS KEINOS

View GitHub Profile
@KEINOS
KEINOS / example.go
Created July 3, 2023 10:37
[Golang] Example of float64 addition that doesn't sum up as expected. [IEEE 754]
package main
import "fmt"
// View it online: https://go.dev/play/p/GUuSXWcLUZ-
func main() {
// IEEE 754
a := 0.1
b := 0.2
@KEINOS
KEINOS / README.md
Created June 25, 2023 01:49
[Golang] Generics example function for string and slice of strings as an argument.

Generic Go Function: Handling Strictly Different Argument Types

Simple example of a Go function that uses generics and takes a string or slice of strings as arguments.

foo("Hello, world")
foo([]string{"Hello, world", "こんにちは、世界"})
@KEINOS
KEINOS / setup-alpine-ja.sh
Last active March 6, 2025 06:44
[Alpine Linux] デスクトップ構築 日本語環境化スクリプト(xfce4, ibus, anthy)
#!/bin/sh
USER_NAME_LOGIN="keinos"
USER_NAME_FULL="KEINOS"
USER_SSH_KEY_URL="https://github.com/KEINOS.keys"
# ---------------------------------------------------------------
# Set repository mirror to the closest
# ---------------------------------------------------------------
# Detect and add fastest mirror and enable the community repo
@KEINOS
KEINOS / README.md
Created June 11, 2023 06:11
[Alpine Linux] Packages that "chromium" and "firefox" package will install.

The below list is the diff of apk list --installed between before and after apk add chromium firefox.

alsa-lib-1.2.9-r3
aom-libs-3.6.1-r0
at-spi2-core-2.48.3-r0
avahi-libs-0.8-r13
brotli-libs-1.0.9-r15
cairo-1.17.8-r2
cairo-gobject-1.17.8-r2
@KEINOS
KEINOS / README.md
Last active March 13, 2024 17:05
[NanoPi NEO2] Cronjob example to reboot Armbian machine by detecting the CPU temperature.

Auto Rebooting NanoPi NEO2 NAS Before Crash

This gist explains how to reboot the NanoPi NEO2 NAS before the CPU temperature rises too high and the device crashes.

Cron Job Setting Example

$ sudo crontab -l
# Check CPU temperature every 30 min (reboot if over 70°C)
*/30 * * * * /root/cron_jobs/onheat_reboot.sh > /root/cron_jobs/onheat_reboot.log 2>&1
@KEINOS
KEINOS / README.md
Created May 24, 2023 12:06
[Memo] CheatSheet for GitHub Actions Job step versions
@KEINOS
KEINOS / Proxmox.md
Last active October 9, 2023 02:50
[Memo] Hardware spec information to install Linux on iMac Late2009 and old PC.
@KEINOS
KEINOS / README.md
Created May 17, 2023 12:22
How to verify the SHA2-256 checksum file in macOS.

How to verify the checksum file?

TL; DR

Use -c or --check option of shasum or sha256sum command.

$ # The target ISO image and its hash file
$ ls 
alpine-extended-3.18.0-x86_64.iso alpine-extended-3.18.0-x86_64.iso.sha256
@KEINOS
KEINOS / README.md
Last active May 28, 2023 08:44
Identity file for Gistargazer, the badge service for number of stars in a gist. See: https://github.com/KEINOS/gistargazer

Example repo for Gistargazer API

This gist repository is an example of a Gistargazer API ID file deployment.

Notes

  • The only file required is "gistargazer.json", the others are ignored.
  • The gist ID (in this case "42f5f23053ab59ca480f480b8d01e1fd") is the Gistargazer API user ID.
  • After submitting the ID file "gistargazer.json" to the gist repository with "allow_badge" element as "yes", go to the following URL and check that the file appears:
  • https://gist.githubusercontent.com///raw/gistargazer.json
@KEINOS
KEINOS / MBP.md
Created May 14, 2023 23:45
[Memo] KEINOS' Hardware Information

Hardware information to prepare for Linux migration before Apple support ends.

$ date -R
Mon, 15 May 2023 08:41:18 +0900

$ sw_vers
ProductName:	macOS
ProductVersion:	12.6.5
BuildVersion:	21G531