2023-01-01から1年間の記事一覧

Raspberry Pi でスワップファイルを無効にする

スワップファイルを消して、無効にする(永続) : $ sudo swapoff --all $ sudo systemctl stop dphys-swapfile $ sudo systemctl disable dphys-swapfile check : $ sudo systemctl is-enabled dphys-swapfile > disabled $ sudo systemctl status dphys-sw…

行を間引いて表示

分毎のログを大雑把に見るため行を間引いて(スキップして)表示したい。 pythonで書いた。1 #!/usr/bin/env python3 import argparse def setup_parser(): p = argparse.ArgumentParser() p.add_argument('infile') p.add_argument('skip', type=int) retur…

import requests するとエラーが出る

エラーが出る ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. 原因 requests(==2.30.0)最新版をインストールすると依存関係のurllib3(==2.0.2)最新版がインストールされる。 が、re…

構造体が境界調整されるのを回避する(パディング、アライメント)

構造体は境界調整される(パディング=詰め物、アライメント=調整) コンパイラがデータをメモリに効率良い様に配置する。 奇数アドレスを避け、偶数アドレスにする。 処理系によっては2byte単位ではなく4byte単位になったりする。 typedef struct { char a;…