Skip to content

Instantly share code, notes, and snippets.

View knknkn1162's full-sized avatar

Kenta Nakajima knknkn1162

View GitHub Profile
@kenmori
kenmori / TypeScriptPractice.md
Last active May 1, 2024 06:02
TypeScript 練習問題集
@bjoern-r
bjoern-r / create_start_minichroot.sh
Created April 8, 2019 19:45
Script to create a minimal chroot with busybox, dropbear and dtach and allow ssh access on port 5022
#!/bin/bash
CHROOTDIR=/opt/minichroot
mkdir -p ${CHROOTDIR}/bin
mkdir -p ${CHROOTDIR}/lib64
mkdir -p ${CHROOTDIR}/etc/dropbear
mkdir -p ${CHROOTDIR}/dev
mkdir -p ${CHROOTDIR}/tmp
@tenpoku1000
tenpoku1000 / AC_2018-12-11_NMI.md
Last active April 19, 2024 16:00
NMI に割り込まれたい

NMI に割り込まれたい

2024/04/20 更新

この記事は、自作OS Advent Calendar 2018の 12/11 の記事として書かれました。

2018 年 12 月現在の PC では NMI が、どんな時に発生するのか、あるいは意図的に発生させることができるのか、調べてみました。 致命的なハードウェア・エラー発生時以外に、デバッグ用途で意図的に発生させることができる場合があるようです。

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

logging入門

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

loggingの使い方

ライブラリの利用者

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

@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 の五つ前の状態を示す
@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
@261shimizu
261shimizu / パーティションあれこれ.md
Last active April 21, 2024 00:37
パーティションとか、ファイルシステムとか+ファイル管理基礎

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

背景


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

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


@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が成功するまで叩き続ける、みたいなスクリプトに仕上げたくなるわけです。

@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
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.