Skip to content

Instantly share code, notes, and snippets.

View hnakamur's full-sized avatar

Hiroaki Nakamura hnakamur

View GitHub Profile
@ityonemo
ityonemo / test.md
Last active July 1, 2026 09:08
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@kprotty
kprotty / ThreadPool.zig
Last active March 20, 2024 16:12
simple http server compatible with wrk for linux using epoll
const std = @import("std");
const system = switch (std.builtin.os.tag) {
.linux => std.os.linux,
else => std.os.system,
};
const ThreadPool = @This();
max_threads: u16,
counter: u32 = 0,
@voluntas
voluntas / shiguredo_model.rst
Last active September 12, 2025 00:11
時雨堂を支えるビジネスモデル

時雨堂を支えるビジネスモデル

更新:2023-12-08
作者:@voluntas
バージョン:2023.2
URL:https://voluntas.github.io/

タイポなどは Twitter の @voluntas までお願いします。

@rsms
rsms / foo.service
Created October 3, 2020 00:18
Example go http server with systemd socket activation and zero-downtime restart
[Unit]
Description = Foo HTTP server
Requires = foo.socket
After = multi-user.target
[Service]
User = www-data
Group = www-data
WorkingDirectory = /var/foo
ExecStart = /var/foo/bin/foo-server
@hiroyuki-sato
hiroyuki-sato / def_route_iface.c
Created September 19, 2020 14:45
check default router interface on macOS.
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#include <net/route.h>
#include <netinet/in.h>
#include <net/if.h>
int main(int argc,char *argv[]){
int mib[6];
@WoodyAtHome
WoodyAtHome / datetime.zig
Last active December 21, 2023 18:44
unix timestamp to local time and date conversions (for Berlin/Amsterdam)
const std = @import("std");
const TimeOffset = struct {
from: i64,
offset: i16,
};
const timeOffsets_Berlin = [_]TimeOffset{
TimeOffset{ .from = 2140045200, .offset = 3600 }, // Sun Oct 25 01:00:00 2037
TimeOffset{ .from = 2121901200, .offset = 7200 }, // Sun Mar 29 01:00:00 2037
@mala
mala / social-distance-internet-meme-research.md
Created May 14, 2020 06:46
アカウント名にスペース入れてソーシャルディスタンス、って謎の風習、最初はどこから始まったの?

アカウント名にスペース入れてソーシャルディスタンス、って謎の風習、最初はどこから始まったの?

5/10 に書いたこれ https://gist.github.com/mala/08fdbc680d84bb1b2305688282f26cea に関連して

というTweetがあり、自分もインターネットミームとしての側面については気になっていたため調べていた。(事前に把握していたものも含む)

普段からTwitterをクロールしていたわけではなく、大規模なデータを持っていないので、実際にどこが発端になって、どういう流れで広まっていったのか正確なところは良く分からない。経緯を把握しているものだとシャープを参考にした(シャープはアカウント名部分ではないけど)というものがあるのは知っている。フォロワー数も非常に多く、企業SNS運用担当者の中では圧倒的な影響がある。

@itchyny
itchyny / go114-regression.md
Last active April 8, 2020 23:23
Go 1.14の主なregression

Go 1.14 の主なregressionです。1.14.1で修正されると思われます。

@voluntas
voluntas / sqlite3_json.md
Created March 15, 2020 08:28
SQLite3 で JSON 拡張 コトハジメ

SQLite3 で JSON 拡張 コトハジメ

注意

  • SQL 素人が書いてます

テーブルとデータ

CREATE TABLE authn_log (
@koron
koron / Changes of profiles of Windows Terminal.md
Last active November 13, 2020 01:59
Windows Terminal の設定ファイルの差分

schema.json とか defaults.json がなんなのかは説明しない。
JSON Schema はソラで読めることが前提。
今後の更新にキャッチアップするかは不明。

1.4.2652.0-preview → 1.5.3142.0-preview

1.5 プレビュー版の変更です。

デフォルトブランチ名の変更