Skip to content

Instantly share code, notes, and snippets.

View knknkn1162's full-sized avatar

Kenta Nakajima knknkn1162

View GitHub Profile
socat Examples
===============
* 注意
- SYSTEM で : を使う時は必ずエスケープすること
* 相手に接続
# telnet, netcat, socat それぞれの場合
$ socat - TCP:127.0.0.1:8000
@dmvaldman
dmvaldman / promisesEM.md
Last active June 1, 2024 00:20
Promises as EventEmitters

Promises as EventEmitters

I was trying to understand JavaScript Promises by using various libraries (bluebird, when, Q) and other async approaches.

I read the spec, some blog posts, and looked through some code. I learned how to

@qnighy
qnighy / normalforms.md
Last active July 27, 2020 08:04
いろいろな標準形

Jordan標準形 (Jordan normal form)

K:代数閉体, V:有限次元のK-線形空間, f : V → V 線形写像のとき、Vの基底を上手く選ぶと表現行列がJordanブロックを対角線上に並べた行列になる。

この標準形はJordanブロックの順列を除いて一意である。

計算方法1: 固有方程式を解き固有値を得る。(A-λI)x=0となるxを探す。(A-λI)y=xとなるyを探す。これを止まるまで繰り返すことで基底の一部が得られる。別の固有ベクトルや別の固有値に対しても同様のことを行う。

有理標準形 (Frobenius normal form)

@noelboss
noelboss / git-deployment.md
Last active June 5, 2024 11:58
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@katzchang
katzchang / sleep-well.md
Last active September 21, 2021 02:30
処理が成功するまで実行しつづける - @katzchang.gist

処理が成功するまで実行しつづける

インスタンスの起動スクリプトとかを書いてるときによく欲しいと思うやつです。

例えば、 service nginx start が実行されたあとに curl -i localhost | grep "200 OK" とかをすると、サービスがそれなりに動いていることが確認できてよかったりするのですが、あまりにも直後だとサーバの起動が間に合わず、curl が失敗してしまいます。nginxだとまだましだけど、アプリケーションサーバだとそれなりに時間がかかったりする。

古典的な解決方法は、 sleep 30 です。簡単だけど、アプリケーションが巨大になってくると30秒では起動しないこともある。じゃぁ sleep 60 が妥当か?でも、サーバインスタンスの起動スクリプト全体はできるだけ早く立ち上がってほしい。困った。

なので、curlが成功するまで叩き続ける、みたいなスクリプトに仕上げたくなるわけです。

@261shimizu
261shimizu / パーティションあれこれ.md
Last active April 21, 2024 00:37
パーティションとか、ファイルシステムとか+ファイル管理基礎

パーティションのあれこれ

背景


パーティションを何気なくfdisk /dev/sdbとかやって作ったとき、に様々な警告について出くわす
1つずつ調べたのでまとめる

このギストに書いてあること


@stknohg
stknohg / Write-BOMlessUTF8Sample.ps1
Last active February 3, 2023 02:05
PowerShellでBOM無しUTF8を書くサンプル
# 例1
"書き込み内容" `
| % { [Text.Encoding]::UTF8.GetBytes($_) } `
| Set-Content -Path ".\BOMlessUTF8.txt" -Encoding Byte
# 例2
Get-Content -Path ".\Source.txt" -Raw -Encoding Default `
| % { [Text.Encoding]::UTF8.GetBytes($_) } `
| Set-Content -Path ".\BOMlessUTF8.txt" -Encoding Byte
@kymmt90
kymmt90 / git-reflog.md
Last active December 28, 2022 11:42
`git reflog` についてまとめてみる

git reflog についてまとめてみる

reflog とは

  • reflog(参照ログ)とは HEAD やブランチ先端の動きの履歴
    • 各個人のローカルリポジトリに存在
    • ブランチの切り替え、新たに加えられた変更のプル、履歴の書き換え、あるいは単なる新規コミットの実行などを記録
  • git reflog で HEAD の移動履歴を、git reflog <ブランチ名> でそのブランチ先端が指していたコミットの一覧を確認可能
    • HEAD@{5}: HEAD の五つ前の状態を示す

logging入門

長すぎにならない程度に使い方をまとめてみる。

loggingの使い方

ライブラリの利用者

既に存在するアプリを実行するファイルの場合

systemd-nspawn container architecture

This short document will show how to turn systemd-nspawn into a usable containeration system.

Those instructions here should work under Arch Linux and Debian 10 (Buster)

Host requirements

  • systemd-nspawn and machinectl (systemd-container package under Debian)
  • dnsmasq
  • debootstrap