Python Dockerfile
FROM python:3 RUN mkdir /code WORKDIR /code COPY requirements.txt /code/ RUN pip install -r requirements.txt
FROM python:3 RUN mkdir /code WORKDIR /code COPY requirements.txt /code/ RUN pip install -r requirements.txt
Get Docker Engine - Community for Ubuntu | Docker Documentation
usermod -aG GROUP USER adduser USER GROUP https://qiita.com/orangain/items/056db6ffc16d765a8187
<meta property="og:locale" content="ja_JP"> <meta property="og:type" content="website"> <meta property="og:title" content="TITLE"> <meta property="og:description" content="DESCRIPTION"> <meta property="og:image" content="IMAGE_FULL_URL"> Card Validator | Twitter Developers https://qiita.com/kana-t/items/f058f29ddd93e062761c https://qiita.com/kogache/items/9e49c94758be8c1c4d77 <link rel="shortcut icon" href="FAVICON_URL"> https://qiita.com/uraranbon/items/a143d215b7baa3e9d1a0
URL:USERNAME.github.io リポジトリ:USERNAME.github.io ブランチ:master 通常のGitHub Pagesと違ってmasterブランチが使われる https://qiita.com/ryokosuge/items/f929821ba5ae9ba2c32b
Git https://qiita.com/TakesxiSximada/items/ea778bb98b8c057ffd07 https://gitpython.readthedocs.io/en/stable/tutorial.html Markdown convert https://python-markdown.github.io/ https://qiita.com/masakuni-ito/items/593b9d753c44da61937b
from pydub import * import numpy as np import time # https://own-search-and-study.xyz/2017/11/19/numpy%E3%81%AEarray%E3%81%8B%E3%82%89pydub%E3%81%AEaudiosegment%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B/ # https://maoudamashii.jokersounds.com/archives/song_kouichi_the_milky_way.html path = 'song_kouichi_the_milky_way.m4a' # https://github.com/jiaaro/pydub/blob/master/API.markdown#audiosegmentfrom_file sound = AudioSegment.from_file(path, format='m4a') # give format explicitly samples = np.array(sound.get_array_of_samples()) print(path) print('Sample width (Num of bytes of a sample):', sound.sample_width) print('Frame rate (Num of samples per second):', sound.frame_rate) print('Channels (Stereo/Mono):', sound.channels) print('Shape (Length):', samples.shape) print('Type:', samples.dtype) print('Min/Max:', samples.min(), samples.max()) output = AudioSegment( samples.astype('int32').tobytes(), sample_width=4, frame_rate=44100, channels=2, ) ts = time.time() output.export('output.m4a') elapsed = time.time() - ts print('Exported as m4a: %f s' % elapsed) ts = time.time() output.export('output.mp3') elapsed = time.time() - ts print('Exported as mp3: %f s' % elapsed) ts = time.time() output.export('output.wav') elapsed = time.time() - ts print('Exported as wav: %f s' % elapsed) song_kouichi_the_milky_way.m4a Sample width (Num of bytes of a sample): 2 Frame rate (Num of samples per second): 44100 Channels (Stereo/Mono): 2 Shape (Length): (22339584,) Type: int16 Min/Max: -32768 32767 Exported as m4a: 6.288757 s Exported as mp3: 6.194534 s Exported as wav: 6.064215 s 出力時間はフォーマットによって変わらない(誤差の範囲)
メモ。 TPLink Wireless Driver 開発ボードにはWi-Fiモジュールが乗ってないので、USBドングルで無線LANにつなぐ(セットアップは有線で)。 TPLink Archer T2U Nanoを使う。 tp-link Archer T2U Nano AC600をLinuxで使う方法 | Shizuka’s Style (Duo) Jetson Nano で TP-LINK Archer T2U Nano を使う - Qiita https://devtalk.nvidia.com/default/topic/1051503/jetson-nano/make-usb-wifi-dongle-rtl8812au-works-on-nano/ NVIDIA Developer Forumsのつい最近(11/27)のポストで、新しいcommitで動かなくなっちゃったからCommit IDd277c36がいいよ、っていってる人がいる。でもT2U NanoのIDが登録されたのは2つ後の4235b0eなので、これを使ってみたけど、これで動いた(OSはr32.2.3)。この1つ後(現在masterの最新commit)のfa68771は接続が確立しなかった(パスワードの入力を何度でも求められる)。警告回避のためにリファクタリングしたらバグったっぽい(コミットコメント、プルリク)。 sudo apt install dkms git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git git checkout 4235b0ec7d7220a6364586d8e25b1e8cb99c36f1 Edit Makefile CONFIG_PLATFORM_I386_PC = n CONFIG_PLATFORM_ARM_JET_NANO = y sudo make -f Makefile.dkms install reboot ibus-mozc sudo apt install ibus-mozc killall ibus-daemon ibus-daemon -x & Python PyTorch使うならシステムのPython 3.6.9を使うのがよさそうだったので、そのまま ...
※ Dockerは入ってるものとします。あとスワップ領域を用意しておいたほうがいいかな docker run --name ncdb --restart unless-stopped -v NEXTCLOUD_DIR/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=MY_ROOT_PASSWORD -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD=MY_PASSWORD hypriot/rpi-mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci docker run --name ncapp --restart unless-stopped --link ncdb -p MY_PORT:80 -v NEXTCLOUD_DIR/www:/var/www/html -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud -e MYSQL_PASSWORD=MY_PASSWORD -e MYSQL_HOST=ncdb:3306 -e NEXTCLOUD_TRUSTED_DOMAINS="MY_DOMAIN" nextcloud NEXTCLOUD_DIR/www/config/config.php overwriteprotocol: 'https' overwritewebroot: '' overwrite.cli.url: 'https://MY_DOMAIN' この設定をしないとhttps環境ではクライアントからログイン(Grant access)できない(webrootはいらないかな)
使用:Intel RealSense SR300 pyrealsense2からget_color_frameで取得したカラー画像が暗かった。 RealSense SDKをインストールしてRealSense Viewerで確認してみると、RGB Cameraの項のEnable Auto Exposureの値がOFFになっていた。これをONにしたらプレビュー画像が明るくなった(露光の自動調整機能かな)。 次はコード(Python)からこのオプションを有効にする。(Pythonの)サンプルにはオプションをいじってるいい感じのものが見つからなかったので、以下を参考にしつつipythonで探した。 RealSense+Pythonの1コマンド環境構築 - Qiita enable/disable auto exposure · Issue #3141 · IntelRealSense/librealsense · GitHub デバイスとカラーセンサ(カメラ)を見つける部分(前半)は適当だけど、コード全体はこんな感じ。 import pyrealsense2 as rs import numpy as np import cv2 ctx = rs.context() device_list = ctx.query_devices() num_devices = device_list.size() print(num_devices) assert num_devices > 0 device = device_list[0] sensors = device.query_sensors() color_idx = -1 for i in range(len(sensors)): if not sensors[i].is_depth_sensor(): color_idx = i break assert color_idx != -1 color_sensor = sensors[color_idx] color_sensor.set_option(rs.option.enable_auto_exposure, 1) # on pipeline = rs.pipeline(ctx=ctx) config = rs.config() config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) pipeline.start(config) print('Initialized') try: while True: frames = pipeline.wait_for_frames() color_frame = frames.get_color_frame() if not color_frame: print('no frame') continue color_image = np.asanyarray(color_frame.get_data(), dtype=np.uint8) print(color_image.max(), color_image.min()) print(color_image.shape) cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE) cv2.imshow('RealSense', color_image) cv2.waitKey(1) finally: pipeline.stop() センサに対してオプションを設定する部分。 ...