2016年3月27日日曜日

raspberry pi 3 raspbian arch 日本語

まず raspbianです。


 dd if=./2016-03-18-raspbian-jessie.img of=/dev/mmcblk0 bs=16M
をした後
gpartedをして 膨らましておきます。


sdをいれてブートすると いきなり GUIです。
wifi は


赤丸 つまり 右上隅を クリックしたら そのまま  wifi ルーター設定になりつながります。

 この後の日本語などの導入ですが、vnc クライアントで作業をします。
まず aptitude install x11vnc といれ
$ x11vnc とし

他のPCから
 xtightvncviewer 192.168.100.252  Rpi3のアドレス
で入って行ってインスト作業をします。
バーを右クリックすれば いい位置へ移動できます。

なお
pi パスワードは raspberry です。
あとは sudo su でroot権限になれますが

passwd root
をすれば suでrootになれて便利です。

まず

aptitude update

aptitude install fonts-takao-gothic
aptitude install scim-anthy zenity

$ im-config
$ scim-setup

aptitude install  iceweasel

raspi-config ---------------> time zone ; tokyo
で基本はすべて入りました。
ここでリブートします。
これで 基本は出来上がってます


ただどこかを触ってメニュー ノッペラボーな時は
http://turtle2005.blog.so-net.ne.jp/2010-01-28-2 による
$HOME/.cache/.sessionを削除すれば修復する
でなおった。 しかし 驚いた。



https://www.maker.io/en/blogs/raspberry-pi-3-how-to-configure-wi-fi-and-bluetooth/03fcd2a252914350938d8c5471cf3b63
 wifi bluetoothとってはいいサイトです。


備忘録
youtube downloader
minidlna
cheese

guvcview
vlc
gparted
rsync
ffmpeg
aptitude install  git  yasm  pkg-config
cd Downloads
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure
make
sudo make install




次は

arch linux です。
ネットでの苦労はないのですが、
残念ながら 音に雑音がまじり きくに耐えないのでやめました。


pi 2 のrasbian は 起動に失敗します。


カーネルがきっと新しいだろう、arch linuxをいれることにしました。
結果的には 以下のように 日本語入力も 内臓wifiも使えてます。
















  • Connectivity – 10/100M Ethernet, WiFi 802.11 b/g/n up to 150Mbps and Bluetooth 4.1 LE (BCM43438 module)

  •  
     https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3



    /boot
    bcm2709-rpi-2-b.dtb cmdline.txt fixup_cd.dat kernel7.img start_cd.elf
    bcm2710-rpi-3-b.dtb config.txt fixup_db.dat overlays start_db.elf
    bootcode.bin fixup.dat fixup_x.dat start.elf start_x.elf


    /root/
    bin dev home lost+found opt root sbin sys usr
    boot etc lib mnt proc run srv tmp var


    となります。 



    rootのパスワードは rootですが、
    rootでは sshではいれません。


    uname -arは
    Linux alarmpi 4.1.19-2-ARCH #1 SMP Sat Mar 5 22:22:01 MST 2016 armv7l GNU/Linux
    なので きっとカーネルは  4.1.19なのでしょう。

    しかし armvは 8ではなく 7です。

    また wifiをそのままでは認識しません、でもちょっと頑張るとできました。
    bluetoothは つなげてませんが、できてるかもしれません。


    Xと日本語の構築は
     http://hatahata50.blogspot.jp/2014/11/arch-linux.html
    を見てください。


    なお
    http://www.cnx-software.com/2016/03/01/raspberry-pi-3-odroid-c2-and-pine-a64-development-boards-comparison/







    イギリス
    Raspberry Pi 3
    韓国
    ODROID-C2
    アメリカ
    Pine A64 Plus

    の比較があります

    2015年12月29日火曜日

    raspberry pi で minibian 日本語 openvpn など



     うどん犬の animation GIFです


    開発者の言葉 「子供たちが占有でき 十分に安価で 頑強で
    楽しくプログアラミングできることを願ってる」


    今はRasbianでやってるが 最初はminibianで始めた。 小さい方が軽いと思ったが
    少なくともyoutubeは Rasbianの方がなめらかだ。 チワワより大きなグレートデンの方が足がはやいんだよねー

    赤い矢印の先の手のひら位のが量子コンピューター :シュレジンガーの猫を思い出す

     
    さて openbsdはコンピュータ教育には最高で すべてがソースからできてることが実感できる。 しかしコンパイルには 早いCPUが必須(カーネルも SSHも Xも何もかもコンパイルにつぐコンパイルで 数字とアルファベットだけからすべてを作り上げる http://openbsd-akita.blogspot.jp/2015/10/xenocara.html見てね。 もちろんfirefoxも java も portを利用してソースからコンパイルできるが 時間がかかる portにある数百あるアプリをソースからコンパイルはとても 普通のパソコンではできない、ミニスパコンが要る。 でportにあるものはまずパッケージでいれる、 うまく動かないとコンパイルだね )。

    この反対側にraspberry piはいる、 これは遅いのでコンパイルは時間がかかって苦痛。 でもTVの後ろにいて何でもこなす。 自分はyoutube鑑賞や sshdサーバー、 dnlaサーバー、 sambaサーバーが役に立つ。 便利。

     早いCPU=量子コンピューター







     上の図は p2(1Gメモリ)です
     これは 実は minibianでなく raspbianでうごいてます。
    HDDなくても動きますが、 swapは /etc/fstabで HDDに設定してます。
    あとこのHDDに 家族写真とか ダウンロードた動画や音楽が多数入ってます





    さて minibianの インストールです
    4G SDカードをいれて
    dd if=./2015-11-12-jessie-minibian.img of=/dev/mmcblk0 bs=4M


    これで 起動できる。
    root のパスワードは raspberry


    しかし、
    ブートを 514M SDカード
    その他つまり/rootを HDD にしたい時は



    raspberry pi に  HDDをつけ加え
     HDDへ 4Gメモリの/dev/mmcblk0p2の内容をHDDにとりこみます。

    以下その方法を書きます。

    fdisk /dev/sda
    mount /dev/sda1 /ma1
    mkdir -p   /ma1/Rapsberry-p1
    mkdir -p   /ma1/Rapsberry-p2


    ブートに関しては
    mount /dev/mmcblk0p1  /mnt/mmcblk0p1
    mount /dev/mmcblk0p2 /mnt/mmcblk0p2

    (cd  /mnt/mmcblk0p1 ; tar cvpf - .)|( cd /ma1/Rapsberry-p1 ; tar xpf -)


    (cd  /mnt/mmcblk0p2 ; tar cvpf - .)|( cd /mb1/Rapsberry-p2 ; tar xpf -)


     dd if=/dev/mmcblk0 of=/ma1/Rapsberry-p1/rasberry-mbr.img bs=512 count=1


    ルートに関しては
    cd /ma1

    cp --archive /bin /etc /home /lib /opt /root /run /sbin /srv /tmp /usr /var ./


    ここでもし
     cp: `/run/user/1000/gvfs' を stat できません: 許可がありません
    がでたら
    http://server-setting.info/blog/gvfsd-fuse-warning.html

    /etc/fuse.conf にて、他ユーザからのアクセスを許可するように設定する

    $ sudoedit /etc/fuse.conf
    ...
    # 最終行に以下を追記する
    user_allow_other



    あるいは

     killall gvfsd-fuse
    をしてから
    cp --archive /bin /etc /home /lib /opt /root /run /sbin /srv /tmp /usr /var ./
    をします。
    
    

    mkdir -p boot dev sys mnt proc



    ここで raspberry をシャットダウンし、SDカードを外す。

    そしてノートPCに 
    512M のSDカードと sata HDDとをつける。


    fdisk /dev/mmcblk0
    mkfs.vfat /dev/mmcblk0p1
    mount /dev/mmcblk0p1 /mnt/mmcblk0p1


    ( cd /mb1/Rapsberry-p1; tar cvpf - .)|(cd  /mnt/mmcblk0p1 ; tar xpf -)

     dd if=/mnt/sda1/rasberry-mbr.img of=/dev/mmcblk0 bs=446 count=1

    とSDカードを調整する。


    さらに
     cat /mnt/mmcblk0p1/cmdline.txt
    dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/sda1 rootfstype=ext4 fsck.repair=yes rootwait




     cat  /mb1/etc/fstab
    /dev/mmcblk0p1 /boot vfat defaults 0 2

    /dev/sda1               /         ext4            defaults,nodiratime    0 1
    #/dev/sda1             /         ext4            rw,relatime,data=ordered0 1

    /dev/sda2  none         swap    sw                0      0



    以上で
    512M のSDでブートし 80Gのsata HDD (もちろんsata-usb converterは要る)で運用できる。



    A) 次は
    http://www.htpcguides.com/lightweight-raspbian-distro-minibian-initial-setup/
    をみて
    firmware と Xとを準備します。

    これで keyboadが 日本語になります。

    Users who should be able to run wicd clients need to be added to the group "netdev".
                   │                                                                                       │               
                   │ Users to add to the netdev group:                       │               
                   │                                                                                       │               
                   │     [*] pi                                                                         │               
                   │                                                                                       │            
                   │                                                                                       │               
                   │                                        <Ok>




    B)最後が日本語環境です。


    4-4) キーボードをJP106に変更

    X端末で
    setxkbmap jp
    とするのが簡単。


    4-5)日本語フォントの導入

    apt-get install aptitude

    aptitude install fonts-takao-gothic

    これで 日本語のページが見れるようになるので、残ったのは日本語入力だけになる。


    4-6) ついでに

    aptitude install vim
    aptitude install firefox-poretable



    4-7) localesを入れて日本語に変更
    # apt-get install locales

    # dpkg-reconfigure locales
    ja-JP.UTF-8 を選択。



    4-8) タイムゾーン
    # dpkg-reconfigure tzdata

    Asia→Tokyo を選択。




    4-9) 日本語入力 scim−anthy です。

    aptitude install  scim  scim-anthy  im-config  zenity


    環境を整えます
     .bashrc に次を付け加えます
    export GTK_IM_MODULE="scim"
    export QT_IM_MODULE="scim"
    export XMODIFIERS="@im=SCIM"


    なお
    im-configで scim を選びます。


    あと日本語キーボードにするために
    ./comment-out.bat /etc/default/keyboard
    XKBMODEL="jp106"
    XKBLAYOUT="jp"
    XKBVARIANT=""
    XKBOPTIONS="terminate:ctrl_alt_bksp"
    BACKSPACE="guess"


    scim -d
    でスターとするはずです。







    したがって 今は 


    今は 

          キーボード
      sdカード           |    
    rasberry----USB HUB-----変換器-----sata HDD(160G)

     USBメモリ         |
                             マウス

    で運用してます。


    ※サンワサプライ IDE/SATA-USB3.0変換ケーブル 0.9m USB-CVIDE5




    C)ffmpegは
    https://www.assetbank.co.uk/support/documentation/install/ffmpeg-debian-squeeze/ffmpeg-debian-jessie/


    D)監視カメラです。
    普通は motionです。
    # motion
    だけでいい。

    なお /etc/motion/motion.conf  は
    daemon on
    process_id_file /var/run/motion/motion.pid
    setup_mode off
    videodevice /dev/video0
    v4l2_palette 2
    input 8
    norm 0
    frequency 0
    rotate 0
    width 320
    height 240
    framerate 15
    minimum_frame_time 0
    netcam_tolerant_check off
    auto_brightness off
    brightness 0
    contrast 0
    saturation 0
    hue 0
    roundrobin_frames 1
    roundrobin_skip 1
    switchfilter off
    threshold 1500
    threshold_tune off
    noise_level 32
    noise_tune on
    despeckle EedDl
    smart_mask_speed 0
    lightswitch 0
    minimum_motion_frames 1
    pre_capture 0
    post_capture 0
    gap 60
    max_mpeg_time 0
    output_all off
    output_normal on
    output_motion off
    quality 75
    ppm off
    ffmpeg_cap_new on
    ffmpeg_cap_motion off
    ffmpeg_timelapse 0
    ffmpeg_timelapse_mode daily
    ffmpeg_bps 500000
    ffmpeg_variable_bitrate 0
    ffmpeg_video_codec mpeg4
    ffmpeg_deinterlace off
    snapshot_interval 0
    locate on
    text_right %Y-%m-%d\n%T-%q
    text_changes off
    text_event %Y%m%d%H%M%S
    text_double off
    target_dir  /home/tuyosi/KANSI
    snapshot_filename %v-%Y%m%d%H%M%S-snapshot
    jpeg_filename %v-%Y%m%d%H%M%S-%q
    movie_filename %v-%Y%m%d%H%M%S
    timelapse_filename %Y%m%d-timelapse
    webcam_port 8081
    webcam_quality 50
    webcam_motion off
    webcam_maxrate 1
    webcam_localhost on
    webcam_limit 0
    control_port 8080
    control_localhost on
    control_html_output on
    track_type 0
    track_auto off
    track_motorx 0
    track_motory 0
    track_maxx 0
    track_maxy 0
    track_iomojo_id 0
    track_step_angle_x 10
    track_step_angle_y 10
    track_move_wait 10
    track_speed 255
    track_stepsize 40
    quiet on
    sql_log_image on
    sql_log_snapshot on
    sql_log_mpeg off
    sql_log_timelapse off
    sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')




    motion が動かない時は
     http://ubuntuforums.org/showthread.php?t=1337440highlight=webcam+command+line

    より
     ./comment-out.bat kansi-ing.bat
    while true
    do
    y=`date +%F-%H:%M:%S`
    streamer  -c /dev/video0    -o   outfile.jpeg
    cp outfile.jpeg /home/mini/Kansi/$y.jpg
    sleep 10
    done

    で 10秒毎に写真をとって  /home/mini/Kansi/に時刻付きでいれてくれます。


     D)音楽

    icewheasel の アドオンで動画はダウンロードできますね。

    空白を除けるなどファイル名を整理する。
    これしとかないと次のスクリプトが走らない。
     cat Download/Video/kuuhaku_.bat


     for FILE in *; do mv "$FILE" ${FILE// /_}; done
    #英語の空白

     for FILE in *; do mv "$FILE" ${FILE// /_}; done
    #日本語の空白

     for FILE in *; do mv "$FILE" ${FILE//(/_}; done
    #英語の( for FILE in *; do mv "$FILE" ${FILE//)/_}; done


     for FILE in *; do mv "$FILE" ${FILE//(/_}; done
    #日本語の( 
     for FILE in *; do mv "$FILE" ${FILE//)/_}; done

     for FILE in *; do mv "$FILE" ${FILE//\'/_}; done
    #英語の'

    一気にmp3へ
      ./comment-out.bat ikkini-2-mp3.bat

    for x in *.flv ; do  y=`ls $x | cut -d'.' -f1`  ;   ffmpeg -i $y.flv $y.mp3 ; done

    for x in *.mp4 ; do  y=`ls $x | cut -d'.' -f1`  ;   ffmpeg -i $y.mp4 $y.mp3 ; done



    ファイル名の文字コードの変更
    SHIFT_JISへ
     ./comment-out.bat for-file_name.bat-U2S
    for x in `ls ./`
    do
    y=`echo $x | iconv -f UTF-8 -t SHIFT_JIS`
     if [ $x != $y ]; then
     mv $x $y
     fi
    done



    UTF-8へ
    # ./comment-out.bat for-file_name.bat-S2U
    for x in `ls ./`
    do
    y=`echo $x | iconv -f SHIFT_JIS  -t UTF-8  `
     if [ $x != $y ]; then
     mv $x $y
     fi
    done




    なお 大きなTVで 小さな画面は嫌ですので 画面は荒くなっても
    mplayer -fs A.mp4 じゃないとダメです。
    遠くから見ると差し支えないです。

    あるいは再生中 f キーを押す方法もあります。


    F) vsftpd サーバー

    以下ので
     /etc/vsftpd.conf
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    listen=YES
    anonymous_enable=YES
    no_anon_password=YES
    anon_max_rate=30000
    anon_root=/home/pi/MandV

    /home/pi/MandV にスマホがアクセスして
    ここにあるファイルをダウンロードできる 。
    便利だよん

    /dev/root        150608952 7449200 135486164    6% /
    devtmpfs            494120       0    494120    0% /dev
    tmpfs               498436       4    498432    1% /dev/shm
    tmpfs               498436    6736    491700    2% /run
    tmpfs                 5120       4      5116    1% /run/lock
    tmpfs               498436       0    498436    0% /sys/fs/cgroup
    /dev/mmcblk0p1      495848   40504    455344    9% /boot
    tmpfs                99688       4     99684    1% /run/user/110
    tmpfs                99688       4     99684    1% /run/user/1000
    とルートは150Gあるから 余裕たっぷり!

    ただ ftpは50kとおそいので 2Gでるsftpをスマホではつかうほうがよい。



    E)アプデート
     http://qiita.com/hotchpotch/items/dfcb9bd02baf67223eb0
    apt-get update && sudo apt-get -y dist-upgrade && sudo rpi-update
     

    F)wifi
     
    簡単には右下隅をクリックして出るwicdでします
    これが楽です。
    
    
    
    
    CUIだと以下です 
     https://minibianpi.wordpress.com/how-to/wifi/
    のとおりです。
     
    従って
     root@C260:/home/yuma2# ./comment-out.bat /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    root@C260:/home/yuma2# ./comment-out.bat /etc/wpa_supplicant/wpa_supplicant.conf
    ctrl_interface=/var/run/wpa_supplicant
    eapol_version=1
    ap_scan=1
    fast_reauth=1
    network={
            ssid="URoad-9EC"
            psk=33948dd44dd3f20bfc020e81a7e8a4479fab69744a79192677c
    }
    
    rebootしないといけません
     
    なお
     http://denshikousaku.net/raspberry-pi-wifi-lan-usb
     最初に目が付いたのがこれ
     
     BUFFALO 無線LAN子機 コンパクトモデル 11n技術・11g/b対応 WLI-UC-GNM
    
     消費電力は最大2.5Wです。
     
     追記:上記のUSBアダプタは超発熱するらしく、Raspberry Piには使わない方が良いらしいです。
     
     
     つぎに目が付いたのがこれ
     
     PLANEX 無線LAN子機 (USBアダプター型) 11n/g/b 150Mbps GW-USNANO2A (FFP)
    【Amazon.co.jp限定】PLANEX 無線LAN子機 (USBアダプター型) 11n/g/b 150Mbps GW-USNANO2A (FFP)
     
    ただし消費電力最大約1.3Wです。
     
    それで  GW-USNANO2A を使ってます。
     
     % lsusb
    Bus 001 Device 007: ID 2019:ab2a PLANEX GW-USNano2 802.11n Wireless Adapter [Realtek RTL8188CUS]
    Bus 001 Device 006: ID 05e3:0718 Genesys Logic, Inc. IDE/SATA Adapter
    Bus 001 Device 005: ID 17ef:602d Lenovo 
    Bus 001 Device 004: ID 056e:00ca Elecom Co., Ltd 
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
    Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    
    
    
    
    % lsmod
    Module                  Size  Used by
    cfg80211              399468  0 
    rfkill                 16799  2 cfg80211
    8192cu                528485  0 
    joydev                  9427  0 
    evdev                  10552  6 
    sg                     18207  0 
    bcm2835_gpiomem         3023  0 
    uio_pdrv_genirq         2986  0 
    uio                     8228  1 uio_pdrv_genirq
    snd_bcm2835            19739  0 
    snd_pcm                75040  1 snd_bcm2835
    snd_timer              18668  1 snd_pcm
    snd                    52620  3 snd_bcm2835,snd_timer,snd_pcm
    fuse                   82598  3 
    ipv6                  343236  28 
    
    
    
     
     
    あ) bluetooh head set 
    
    
    bluetooth ドングルは planex の BT-Micro4 ブルーツースver4.0対応です。
    消費電力』1/2に引かれました。
    
    
     % dpkg -l | grep blue
    ii  blueman                               1.99~alpha1-1+deb8u1                      armhf        Graphical bluetooth manager
    ii  bluetooth                             5.23-2                                    all          Bluetooth support
    ii  bluez                                 5.23-2+b1                                 armhf        Bluetooth tools and daemons
    ii  bluez-firmware                        1.2-3                                     all          Firmware for Bluetooth devices
    ii  bluez-hcidump                         5.23-2+b1                                 armhf        Analyses Bluetooth HCI packets
    ii  bluez-obexd                           5.23-2+b1                                 armhf        bluez obex daemon
    ii  bluez-test-scripts                    5.23-2                                    all          BlueZ test scripts
    ii  bluez-tools                           0.2.0~20140808-3                          armhf        Set of tools to manage Bluetooth devices for linux
    ii  gnome-bluetooth                       3.14.0-2+b1                               armhf        GNOME Bluetooth tools
    ii  libbluetooth3:armhf                   5.23-2+b1                                 armhf        Library to use the BlueZ Linux Bluetooth stack
    ii  libgnome-bluetooth13                  3.14.0-2+b1                               armhf        GNOME Bluetooth tools - support library
    ii  pulseaudio-module-bluetooth           5.0-13                                    armhf        Bluetooth module for PulseAudio sound server
    ii  python-bluez                          0.20-1                                    armhf        Python wrappers around BlueZ for rapid bluetooth development
     
     
     
     % dpkg -l | grep pavu   
    ii  pavucontrol                           2.0-3                                     armhf        PulseAudio Volume Control
     
     
     
     % /usr/bin/pavucontrol
    したら HDMI か bluetooth かの選択ができ、 HDMIの方をオフにします。
    これで  bluetooth からだけ音がでました。
     
     

     
     
     
    い)ホームネットワーク 試案
    sharp TVで sharpビデオをみよう 
    
    
    dnsmasq はここ
    http://blogging.dragon.org.uk/howto-setup-dnsmasq-as-dns-dhcp/
    
    
    
    
    sharp vide recorder
    |
    |wired クロスケーブル
    |
    eth0
    raspberry pi
    wlan0
    |
    | wifi
    | 
    router
    |
    |wired
    |
    sharp TV 
     
    sharp TV で sharp vide recorde をみます。
     
     
     
     http://www.soramimi.jp/raspberrypi/etherconv/
    が素晴らしいページです。 
    
    
    
    

    /etc/network/interfaces

    インターフェースの設定をします。DHCPは後回しで、とりあえず inet manual と書いておきます。

    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet manual

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-driver wext
    wpa-scan-ssid 1
    wpa-key-mgmt WPA-PSK
    wpa-proto WPA2
    wpa-pairwise CCMP
    wpa-group CCMP
    wpa-ssid "MySSID" 
    wpa-psk "MyPassPhrase" 




    /etc/rc.local


    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    # Print the IP address 
     
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
      printf "My IP address is %s\n" "$_IP"
    fi
    
    echo 1 > /proc/sys/net/ipv4/ip_forward
    
    brctl addbr br0
    brctl addif br0 eth0
    brctl addif br0 wlan0
    dhclient br0
    
    exit 0


     
     もとの  /etc/rc.localは 以下
      ./comment-out.bat /etc/rc.local 
    /usr/bin/printf "         My IP address is\033[0;31m `/sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }'` \033[0m\n" > /dev/console
    exit 0
    
    
    
    
    
     
    う)nslookupがない
     
    aptitude install dnsutils
     
     
    え)apache2
    /var/www/html
     
    お)写真動画 日付順 整理 
     
     
     まず JPGをjpg AVIをaviと名前をかえる
     
    # ./comment-out.bat 1-kuhaku_nokeru.bat 
    find . -name "*" | rename 's/.JPG/.jpg/g'
    find . -name "*" | rename 's/.AVI/.avi/g'
    find . -name "*" | rename 's/ /_/g'
    find . -name "*" | rename 's/ /_/g'
    
    aviを mp4に変える
    # ./comment-out.bat 2-avi-2-mp4.bat 
    for y in  `ls *.avi`
    do
    z=` ffprobe -v quiet -print_format json -show_format  $y | grep creation_time | sed "s/ /_/g" - |sed "s/\///g" -| cut -d '"' -f 4 `
    ffmpeg -i $y $z.mp4
    echo $y $z.mp4
    done
    時間順にならべる
    # ./comment-out.bat 3-album-for.bat 
    ./kuhaku_nokeru.bat
    echo ' photo写真の部 </p>'
    echo ' --------jpg-----------------  </p> '
    for y in *.jpg
    do 
    jhead -nf%Y-%m-%d-%H%M%S $y
    done
    for x in `ls *.jpg`
    do
    echo "<a href=`echo $x`>`echo $x`</a>   </p> </p> "
    done
    echo '                      </p>'
    echo '                      </p>'
    echo '                      </p>'
     
    echo ' movie 動画の部</p>'
    echo ' --------mp4-----------------  </p> '
    for x in `ls  *.mp4 `
    do
    echo "<a href=$x>$x</a>   </p> </p> "
    done

     
    
     
    か)openvpn
     http://ktkr3d.github.io/2015/08/08/OpenVPN-with-Raspberry-Pi/
    をみるだけです。
     
     
     /etc/openvpn/easy-rsa/vars 
    export EASY_RSA="`pwd`"
    export OPENSSL="openssl"
    export PKCS11TOOL="pkcs11-tool"
    export GREP="grep"
    export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`
    export KEY_DIR="$EASY_RSA/keys"
    echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
    export PKCS11_MODULE_PATH="dummy"
    export PKCS11_PIN="dummy"
    export KEY_SIZE=2048
    export CA_EXPIRE=3650
    export KEY_EXPIRE=3650
    export KEY_COUNTRY="JP"
    export KEY_PROVINCE="A"
    export KEY_CITY="A"
    export KEY_ORG="k"
    export KEY_EMAIL="n@gmail.com"
    export KEY_OU="i"
    export KEY_NAME="E"
    
     
     
    /etc/openvpn/server.conf

    port 1194
    proto udp
    dev tun
    ca ca.crt
    cert server.crt
    key server.key  # This file should be kept secret
    dh dh1024.pem
    push “route 192.168.100.0 255.255.255.0”
    server 10.8.0.0 255.255.255.0
    ifconfig-pool-persist ipp.txt
    push "redirect-gateway def1 bypass-dhcp"
    push “dhcp-option DNS 192.168.100.101”
    client-to-client
    keepalive 10 120
    tls-auth ta.key 0 # This file is secret
    comp-lzo
    user nobody
    group nogroup
    persist-key
    persist-tun
    status openvpn-status.log
    log /var/log/openvpn.log
    mode server
    tls-server
    verb 3


































    $ sudo /etc/init.d/openvpn start
    で動作を確認。OKならば次のように自動起動登録します。
    $ sudo chkconfig –add openvpn

    OpenVPN Client のセットアップ

     http://blog.techlab-xe.net/archives/2602
     https://www.manabii.info/2014/11/openvpn-setting-memo-for-debian-7-wheezy.html



    /etc/openvpn/client.ovpn 
    ーーーーーーーーーーーーーーーーーーーーーーーーー 
    client
    dev tun
    proto udp
    remote xx.yy.zz.ww 1194  ;サーバー側のアドレスを入れる
    ca /etc/openvpn/ca.crt
    cert /etc/openvpn/client.crt
    key /etc/openvpn/client.key

    起動
    起動のさせ方です。


    /usr/sbin/openvpn /etc/openvpn/client.ovpn &
    

    http://kmwoley.com/blog/raspberry-pi-openvpn-the-babys-webcam-secure-access-to-your-home-network/
    There are a lot of services out there where you can create your own Domain Name and point it back to your home network. I like https://freedns.afraid.org/ because it’s free. Follow the links in the steps below to get a DNS setup for your home:
    1. Make your account -> freedns.afraid.org -> Signup
    2. Make a DNS record (subdomains -> Add -> Save)
      • Pick any subdomain name and domain that you want. This will be the address you use to find your way home.
      • Leave all the other options as default.
    You’ll see your entry appear in the subdomains page when you’re done. Write down your full domain name (example: yoursubdomain.afraid.org). We’re going to need it later.

    5.2 Update your domain with your external IP address

    Next you need to tell your Raspberry Pi to periodically update freedns.afraid.org so that it knows your current External IP address, in case it changes in the future. We’ll do that by using a tool called crontab which is designed to do things like this periodically.
    1. Go to http://freedns.afraid.org/dynamic/
    2. Look for the link that says ‘quick cron example’ towards the bottom of the page. Click the link.
    3. At the very bottom of the page, you’ll see a line that looks like this:
      3,8,13,18,23,28,33,38,43,48,53,58 * * * * sleep 27 ; wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?blahblahblahblah >> /tmp/freedns_subdomain_domain_com.log 2>&1 &
    4. Copy the line from the bottom of your ‘quick cron example’.
    5. On your Raspberry Pi’s SSH terminal, type the following command.
      crontab -e
      This will open the nano editor. This is the default text file editor on Raspberry Pi.
    6. Scroll to the bottom of the file (using your arrow keys on your keyboard) & paste the text from step 3 into the file.
      • Hint: on Windows, right clicking in the PuTTY window will paste text under your cursor.
    7. Save the file by pressing Ctrl-O, and then Ctrl-X to exit.


    Open a text file editor and create the client-split.ovpn file for OpenVPN:

    nano /etc/openvpn/client-split.ovpn
    Cut and paste the following text into the file you just opened:

    # Split Tunnel OpenVPN client configuration
    client
    dev tun
    proto udp
    
    # you must change 'subdomain.domain.com' 
    # to your home DNS entry
    remote subdomain.domain.com 1194
    
    # ignore the server's instructions about routing
    # all data to the OpenVPN server
    route-nopull
    
    # direct this client to route only a subset of traffic
    # to the OpenVPN server through the tunnel
    #
    # you must change 'INTERNAL_HOME_ADDRESS' to your 
    # home's IP address range.
    route INTERNAL_HOME_ADDRESS 255.255.255.0
    
    # Keep trying indefinitely to resolve the host name
    # of the OpenVPN server.
    resolv-retry infinite
    
    nobind
    persist-key
    persist-tun
    
    # key & authentication configuration
    ca ca.crt
    cert client.crt
    key client.key
    remote-cert-tls server
    tls-auth ta.key 1
    
    # encryption configuration
    cipher AES-256-CBC
    auth SHA512
    
    # enable compression of the data traffic
    comp-lzo
    
    # logging setup
    mute-replay-warnings
    verb 3
    mute 20
    


     き)dlnaです

    aptitude install minidlna

     ./comment-out.bat /etc/minidlna.conf
    media_dir=/home/emi/Downloads/
    network_interface=eth0
    port=8200
    serial=681019810597110
    album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
    album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
    album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

    で簡単です。

    問題は dlnaクライアントです。

    arch linux を利用します。

    まず firefox では 以下とvideoが1つあることだけわかりますが
    ビデオはみれません。




    そこで vlcをarchに導入して
    表示ー> プレイリスト ー>左枠内のローカルネットワークー>ユニバーサルプラグ&プレイ
    で見事にみれます。
    最高!




    みれるのですが 文字化けがあります。なぜでしょう?


    スマホからだと以下です。 これでアルバム整理が終了です。
    Ihttps://youtu.be/tgGz14rggsI


    でもvlcは 気難しいので openbsdで一度ソースからコンパイルしてます。
    しかし 5時間たっても

    で makeがいっぱい。
    早いPCでないと本当にストレスですね。

    コーヒータイム
    恐ろしい数学力があれば  超弦理論から 一般相対性理論も 標準理論(素粒子の数式)も 導きだされてしまう。



     そして https://www.youtube.com/watch?v=7y_BlA3ZTeQ
    の 5分50秒くらいのところに 超弦理論の元は
    200年前の 数学者オイラーのオイラーの関数だったとでてます。



    1)例えば、FAT32 パーティションが /dev/sda9 にあって、/mnt/fat32 にマウントしたい場合、次のようにします:
    /etc/fstab
    /dev/sda9    /mnt/fat32        vfat   user,rw,umask=111,dmask=000    0  0


    2) minidlna
    http://www.htpcguides.com/install-readymedia-minidlna-1-1-4-raspberry-pi/
    は wheezy を jessie  にしたらダメだった。
     萎える。