Skip to content

Instantly share code, notes, and snippets.

View devlights's full-sized avatar
🤧
hay fever....

devlights devlights

🤧
hay fever....
View GitHub Profile
@devlights
devlights / README.md
Created September 14, 2023 07:09
UDPでデータを送る際、ipフラグメントを起こさずに送信できる最大サイズ (MTU=1500byteとする)

MTU(Maximum Transmission Unit)が1500バイトの場合、UDPでデータを送る際にIPフラグメントを起こさずに送信できる最大サイズは以下のように計算できます。

  • Ethernetヘッダ: 14バイト
  • IPヘッダ: 最小で20バイト
  • UDPヘッダ: 8バイト
  • それらのヘッダを引いた値: (1500 - 14 - 20 - 8 = 1458)バイト

したがって、フラグメントを起こさずに送信できる最大サイズは1458バイトになります。

@devlights
devlights / README.md
Last active September 13, 2023 15:30
Go で クロージャ (closure) のサンプル
$ go run main.go
1
2
3
4
5
@devlights
devlights / excel2pdf.go
Created September 11, 2023 10:02
Excel to PDF
package main
import (
"flag"
"fmt"
"log/slog"
"os"
"path/filepath"
"strings"
@devlights
devlights / word2pdf.go
Created September 11, 2023 10:01
Word to PDF
package main
import (
"flag"
"fmt"
"log/slog"
"os"
"path/filepath"
"strings"
@devlights
devlights / install-google-chrome-on-linux(wsl).md
Last active September 6, 2023 04:35
Linux (WSL) に Google Chrome をインストール

Linux (WSL) に Google Chrome をインストール

debファイルを取得し、インストールを試みる。

$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo dpkg -i google-chrome-stable_current_amd64.deb
(Reading database ... 30014 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (116.0.5845.140-1) over (116.0.5845.140-1) ...
@devlights
devlights / README.md
Last active September 3, 2023 09:18
C言語おさらい(自分用)

Run

$ gcc -o app main.c
$ ./app
16975631        16975631        1807    15
15
7
3
1
@devlights
devlights / howto_use_scoop.md
Created August 29, 2023 08:01
Scoop 使い方まとめ

Scoop の使い方まとめ

インストール

$ scoop install xxxxx

アンインストール

@devlights
devlights / README.md
Last active August 23, 2023 08:04
バイトスライスに文字列を速く設定する方法(fmt.Sprintf, fmt.Appendf, 直接append使用)
@devlights
devlights / README.md
Last active July 22, 2023 16:07
ChromebookのLinuxにFlutterをインストール (ARM版) (結局Androidの設定はうまくいかず・・・)

Google Chrome は、ARM版を配布していないので、Chromiumで代用。

$ uname -m
aarch64

$ cd $HOME

$ sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev build-essential chromium
$ git clone https://github.com/flutter/flutter.git -b stable
@devlights
devlights / hello-apple.md
Created July 1, 2022 10:03 — forked from Linrstudio/hello-apple.md
solutions for window.innerWidth / innerHeight issue in iOS9

iOS9 returns double the value for window.innerWidth & window.innerHeight
The versions that are concerned are: 9.0.0, 9.0.1, 9.0.2

A few people got mad on twitter:

window.innerWidth in iOS 9 Safari returns double the number it did in iOS 8? Is this real life? tell me no — @rachsmithtweets
iOS9 Safari has the most insane bug where window.innerWidth / innerHeight is *sometimes* twice as large as it should be. ughhhh. !? — @mattdesl

iOS9 innerWidth/innerHeight is having a lot of fun these days — @ayamflow