Skip to content

Instantly share code, notes, and snippets.

View KEINOS's full-sized avatar

KEINOS KEINOS

View GitHub Profile
@KEINOS
KEINOS / 20230512-1430.md
Created May 12, 2023 05:32
[Sample Post]
title description publishDate draft tags
Hoge
sample post
2023-01-11 23:13:22 +0900
false
sample

Hoge Hoge

@KEINOS
KEINOS / uint64_to_bytes.md
Created May 1, 2023 07:31
[Golang] Converting uint64 to byte slices.

Converting uint64 to []byte in Go

tl; dr

Using LittleEndian.PutUint64 function from encoding/binary package is much faster than bit shifting.

0.3468n/op vs 3.905n/op

import "encoding/binary"
@KEINOS
KEINOS / openpgp.md
Created April 22, 2023 00:43
[Keyoxide] Identity Proof for Keyoxide

openpgp4fpr:4FDD93EDA91BA3AD071ED4118B888AD8EDD27C2D

@KEINOS
KEINOS / README.md
Created April 20, 2023 02:28
[Golang] Example of Fletcher16 implementation in Go.

Example of Fletcher16 (Fletcher's checksum) in Go

package main

import "fmt"

// Fletcher16 returns the checksum of the data using the Fletcher's
// checksum algorithm.
func Fletcher16(data []byte) uint16 {
@KEINOS
KEINOS / README.md
Last active March 2, 2024 18:05
[Golang]: Simple example of Diffie–Hellman key exchange

ディフィー・ヘルマン鍵共有の概念 with Go

package main

import "fmt"

// Public constant
const (
	g = 2 // 基数
@KEINOS
KEINOS / gist_comment.md
Last active March 12, 2023 12:54
[GitHub API v4] GraphQL API Example to retrieve/get comments in Gist.

GitHub GraphQL API (GitHub API v4) example to retrieve/get comments in Gist.

{
  viewer {
    gist(name: "78cc23f37e55e848905fc4224483763d") {
      comments(last: 100) {
        edges {
          node {
 author {
@KEINOS
KEINOS / README.md
Last active March 9, 2023 10:21
[Docker] [Alpine] 5 things you should try if the container fails to boot

5 things you should try if the container fails to boot

  1. Reboot the service.

    sudo systemctl restart docker.service
  2. Try "hello-world".

@KEINOS
KEINOS / README.md
Last active February 9, 2023 02:51
JSON file of Joyo kanjis(常用漢字) to facilitate the search for Japanese kanji readings.

Jōyō Kanjis 2010(常用漢字読み仮名)

In this gist we provide 2 JSON files.

@KEINOS
KEINOS / docker-compose.yml
Created December 8, 2022 09:22
[Ansible Semaphore] docker-compose.yml for Ansible over Semaphore
services:
semaphore:
restart: unless-stopped
ports:
- 3000:3000
image: semaphoreui/semaphore:latest
environment:
SEMAPHORE_DB_DIALECT: bolt
SEMAPHORE_ADMIN_PASSWORD: <your admin password>
SEMAPHORE_ADMIN_NAME: <your admin display name>
@KEINOS
KEINOS / playbook.yml
Last active December 8, 2022 10:13
Sample Playbook
- name: Update and upgrade apt packages
hosts: rpi
user: pi
# Become sudoer
become: yes
tasks:
- name: apt update
apt:
# apt update
update_cache: yes