Ubuntu
Ubuntuにreactをインストールして動作確認する
Ubuntu20.04にインストールしている npmのインストール sudo apt install npm reactのインストール sudo npm -g install create-react-app バージョンの確認 create-react-app --version プロジェクトを作り、開発用サーバーを起動する create-react-app myproject プロジェクトを作る。 cd myproject npm start 開発用サーバーを起動すると自動的にブラウザが立ち上がる。127.0.0.1:3000が表示される。 src/App.jsを下記のように修正するとHelloWorldが表示される。 import React from 'react'; const App = () => { return ...【Python】virtualenvをactivateせずに、venvにインストールしたライブラリを読み込んで実行する【aliasやcrontabなどに】
【Ubuntu】ディスクの読み込みスピードをチェックする【sudo hdparm -tT デバイス名】
Ubuntuのバージョンチェックは lsb_release -a もしくは、cat /etc/os-release でOK
【Linux】grepとsedとxargsで複数のファイルに点在する誤字を一括修正(置換)する
【Ubuntu】tesseractをインストールして、Pythonから画像の文字起こし(OCR)を試す【pytesseract】
環境 Ubuntu 20.04 Python 3.8.10 Tesseract Open Source OCR Engine v4.1.1 with Leptonica 今回使用したPythonライブラリ packaging==21.3 Pillow==9.2.0 pyparsing==3.0.9 pytesseract==0.3.10 UbuntuへTesseractのインストール sudo apt install tesseract-ocr libtesseract-dev libleptonica-dev tesseract-ocr-jpn tesseract-ocr-jpn-vert tesseract-ocr-script-jpan tesseract-ocr-script-jpan-vert 日本語のOCRもできるように訓練済みのデータもインストールしている。 tesseract-ocr-jpn tesseract-ocr-jpn-vert tesseract-ocr-script-jpan tesseract-ocr-script-jpan-vert Tesseractの動作確認 以下画像をdjango.pngと名付けて解析してみる。 tesseract django.png output -l jpn ファイルはoutput.txtに出力される。出力結果はこうなった。 以下、流れ。 1. プロジェクトを作 ...Ubuntuにbeepコマンドをインストール【crontabで時報を作る】
インストール sudo apt install beep 動かす -fは周波数つまり音の高さ、-lはミリ秒指定で音の長さを指定できる。 beep -f 5000 -l 2000 動かないとき 下記コマンドを実行、 sudo vi /etc/modprobe.d/blacklist.conf これを # ugly and loud noise, getting on everyone's nerves; this should be done by a # nice pulseaudio bing (Ubuntu: #77010) blacklist pcspkr こうする。 # ugly and loud noise, getting on everyone's nerves; this should be done by a # nice pulseaudio bing (Ubuntu: #77010) #blacklist pcspkr そして、読み込み直す。 sudo modprobe pcspkr crontabで1時間おきにbeepを鳴らす。 時報として使う事ができる。動かすのは8時から18時まで 00 8-18 * * * user beep -f 880 -l 300 ...Ubuntuのアップグレード時の設定を置き換えてはいけない
FFmpegを使ってUbuntuサーバーにUSBで接続されたウェブカメラで映像を録画する
Ubuntu 22.04 Server ハードはラズパイ3B+ インストール FFmpegとv4l2-utilsをインストール sudo apt install ffmpeg v4l-utils デバイスを特定する v4l2-ctl --list-devices こんなふうに表示される(一部省略) BUFFALO BSWHD06M USB Camera : (usb-3f980000.usb-1.4): /dev/video0 /dev/video1 /dev/media3 対応しているフォーマットと解像度を特定する ffmpeg -f v4l2 -list_formats all -i /dev/video0 こんなふうに表示される(一部省略) [video4linux2,v4l2 @ 0xaaaad7c25420] Raw : yuyv422 : YUYV 4:2:2 : 1280x720 800x600 640x480 640x360 352x288 320x240 176x144 160x120 [video4linux2,v4l2 @ 0xaaaad7c25420] Compressed: mjpeg : Motion-JPEG : 1280x960 1280x720 800x600 640x480 640x360 352x288 320x240 176x144 160x120 映像を録画する ffmpeg -f v4l2 -framerate 30 -video_size 352x288 -i /dev/video0 output.mkv 後はこの映像をscpなどでDLして ...