2016年5月31日

zip dd做映像檔pv秀進度

寫出成img
 dd if=/dev/sdb bs=1M | pv | zip bpi-m3-mate1604-0509.zip -
updating: -51.6MB 0:00:01 [51.6MB/s] [<=>                                       輸入 15279+0 個紀錄4MB/s] [                       <=>                          ]
輸出 15279+0 個紀錄
複製了 16021192704 個位元組 (16 GB), 476.674 s, 33.6 MB/s
14.9GB 0:07:56 [32.1MB/s] [                      <=>                           ]
 (deflated 77%)

寫回SD卡去
 unzip -p bpi-m3-mate1604-0509.zip | pv | dd of=/dev/sdb bs=10M status=noxfer
14.9GB 0:19:38 [  13MB/s] [                    <=>                             ]
輸入 0+124701 個紀錄
輸出 0+124701 個紀錄

2016年5月18日

手機顯微鏡

之前有人介紹不錯的東西,雷射筆鏡頭做成手機顯微鏡。
自己再把它改良了一下,用3d繪圖畫了改良的模組。
之前就public,需要者自取,建議用透明的塑料來列印效果最佳。但忘了寫下記錄。有時要找資料還不好找。記錄一下。
檔案網址:https://www.tinkercad.com/things/4puOQHfhpWM-7mm
 後來看到有人用橡皮筋來綁,想了一下,好方法,真的可以解決鏡頭固定問題。所以又拍張相片記錄。


ubutnu 1604調校記事

ubutnu 1604調校記事

安裝輸入法
apt-get install fcitx fcitx-table-cangjie5 fcitx-chewing fcitx-table-boshiamy
apt-get install firefox-locale-zh-hant
apt-get dist-upgrade

安裝libreoffice base
apt-get install libreoffice-base librecad

 安裝flashplayer
apt-get install flashplugin-installer

安裝解壓縮
apt-get install unrar

重新定義ctrl alt backspace登出

sudo dpkg-reconfigure keyboard-configuration

文字編輯器apt-get install vim 
小畫家
apt-get install kolourpaint4
 
企鵝小畫家
apt-get install tuxpaint tuxpaint-config
vim /etc/tuxpaint/tuxpaint.conf
 
savedir=~/Pictures
windowsize=1024x768
sysfonts=yes


mkdir Downloads
mkdir Pictures
mkdir Videos
mkdir Desktop
mkdir Music
mkdir Documents
mkdir Public
mkdir Template 

rmdir 文件
ln -s ./Documents 文件
rmdir 圖片
ln -s ./Pictures 圖片
rmdir 公共
ln -s ./Public 公共
rmdir 下載
ln -s ./Downloads 下載
rmdir 影片
ln -s ./Videos 影片
rmdir 音樂
ln -s ./Music 音樂
rmdir 桌面
ln -s ./Desktop 桌面
rmdir 模板
ln -s ./Template 模板

安裝audacity
apt-get install audacity

安裝vlc
apt-get install  vlc

安裝gimp
apt-get install gimp gimp-plugin-registry

安裝inkscape
apt-get install inkscape
下載子忠的mo檔
cp ~/Downloads/inkscape.mo /usr/share/locale-langpack/zh_TW/LC_MESSAGES/

安裝kdenlive
apt-get install kdenlive

安裝smplayer
apt-get install smplayer

安裝openshot
apt-get install openshot


安裝java 8
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
 
##安裝adob air
wget -O adobe-air.sh http://drive.noobslab.com/data/apps/AdobeAir/adobe-air.sh
###安裝Scratch2 offline
wget https://scratch.mit.edu/scratchr2/static/sa/Scratch-446.air

wget https://scratch.mit.edu/scratchr2/static/sa/Scratch2StarterProjects.zip


 mv Scratch2StarterProjects /opt/Scratch\ 2/share/

 cd ~/Documents
 ln -s /opt/Scratch\ 2/share/Scratch\ Projects  Scratch\ Projects

##安裝s2a

##安裝python-pip 
apt-get install python-pip
##顯示 pre-installed Python 套件:
pip freeze

##如果沒有出現任何像pyserial==2.5 or pyserial==2.7 在清單中請建立使用 pip, 並安裝 PySerial:

 pip install PySerial
##安裝 PyMata 為了串行通訊在Python 用 Firmata 在 Arduino (PySerial 需要事先安裝 ):
pip install PyMata   
##下載s2a到家目錄
wget https://github.com/MrYsLab/s2a_fm/archive/master.zip


unzip master.zip
cp -a s2a_fm-master /usr/share/
chmod -R 777 /usr/share/s2a_fm-master/ 
 chmod -R 777 s2a_fm-master

wget ftp://163.20.108.1/open/s2a_content.sh
wget ftp://163.20.108.1/open/s2a_content.png
chmod +x s2a_content.sh

 
cp -a s2a_content.sh /usr/share/s2a_fm-master
mv  s2a_content.sh ~/s2a_fm-master
 
cp   s2a_content.png /usr/share/s2a_fm-master
cp ~/s2a_fm-master/ScratchFiles/ScratchProjects/s2a_fm_base_zh_tw.sb2  ~/s2a_fm-master/
cp  /usr/share/s2a_fm-master/ScratchFiles/ScratchProjects/s2a_fm_base_zh_tw.sb2 /usr/share/s2a_fm-master
 
cd ~/Desktop

wget ftp://163.20.108.1/open/s2a_Scratch%202.desktop
chmod 777  s2a_Scratch\ 2.desktop
wget ftp://163.20.108.1/open/s2a.desktop
chmod 777 s2a.desktop

sudo vim /usr/bin/scratch2.sh
 
#!/bin/bash
/opt/Scratch\ 2/bin/Scratch\ 2 ~/s2a_fm-master/s2a_fm_base_zh_tw.sb2

sudo chmod  +x /usr/bin/scratch2.sh
 

 改ttyUSB0的群組
vim /etc/group
找到 dialout
在:後加入使用者,我這裡習慣用teacher和student就會成為下列
dialout:x:20:teacher,student   


安裝網路工具 
apt-get install gnome-nettool
檔案總管工具(ubuntu mate not do)
apt-get install nautilus-image-converter nautilus-image-manipulator
mate do this 
apt-get install caja-image-converter 
 
安裝photofilmstrip
wget http://nbtelecom.dl.sourceforge.net/project/photostoryx/photofilmstrip/2.1.0/photofilmstrip_2.1.0-1_all.deb

dpkg -i photofilmstrip_2.1.0-1_all.deb
apt-get -f install 

安裝imagination
apt-get install imagination

安裝ktouch打字練習
apt-get install ktouch

安裝企鵝愛打字
apt-get install tuxtype

安裝sweethome3d
apt-get install sweethome3d
下載jar
https://sourceforge.net/projects/sweethome3d/files/SweetHome3D/SweetHome3D-5.2/


開機選單調整grub-customizer

sudo -s
add-apt-repository ppa:danielrichter2007/grub-customizer
apt-get update
sudo apt-get install grub-customizer
 
firefox匯入政府憑證
http://gca.nat.gov.tw/repository/Certs/GCA2.cer
 
安裝傳統選單 (mate not do)
apt-get install classicmenu-indicator
 

安裝gparted
apt-get install gparted

安裝blender
sudo add-apt-repository ppa:thomas-schiex/blender
sudo apt-get update
sudo apt-get install blender
 
安裝wine 
apt-get install winetricks wine wine1.6-amd64 
 
安裝ffmulticonverter(有問題)
apt-get install unoconv 
 https://github.com/Ilias95/FF-Multi-Converter


 
 在 /etc/apt/sources.list 加入
   deb http://www.deb-multimedia.org sid main

   然後
    sudo apt-get update
    sudo apt-get install deb-multimedia-keyring
  
   apt-get install ffmulticonverter 

 
安裝髮型彩粧
 http://jkiwi.com/download/ubuntu/下載deb安裝
wget http://nchc.dl.sourceforge.net/project/jkiwi/jkiwi/jKiwi-0.9.5/jkiwi_0.9.5_ubuntu.deb
dpkg -i jkiwi_0.9.5_ubuntu.deb
 
https://sites.google.com/site/estea8968/home/ntpc-2014-unity/jkiwi_locale_zh_TW.properties?attredirects=0&d=1 
 
 
安裝pdf閱讀器 
 apt-get install okular 
 
pdf編輯軟體
apt-get install pdfshuffler

投影片秀
 sudo add-apt-repository ppa:ffdiaporamateam/stable
sudo apt-get update
sudo apt-get install ffdiaporama ffdiaporama-openclipart ffdiaporama-texturemate
 
 
---------------------0520----------- 
webcam工具


apt-get install kamoso 


遇到 kde-config-telepaty-accounts出問題,要用
cd /var/cache/apt/archives
dpkg -i --force-overwrite kde-config-telepathy-accounts_4%3a15.12.3-0ubuntu1_amd64.deb
 
 
7zip解壓縮
 sudo apt-get install p7zip p7zip-full p7zip-rar

 
安裝kde語言套件 
apt-get install kde-l10n-zhtw 

安裝shutter
 sudo apt-get install shutter
 
安裝k3b 
 apt-get install k3b k3b-i18n libk3b6-extracodecs
 
 安裝看圖片程式
  apt-get install gthumb
 
安裝arduino ide 
  apt-get install arduino
安裝ArduBlock 
wget http://jaist.dl.sourceforge.net/project/ardublock/ardublock-beta-20140702.jar 
 
mkdir /usr/share/arduino/tools/ArduBlockTool
mkdir /usr/share/arduino/tools/ArduBlockTool/tool 
 


安裝教育部標準楷書和全字庫字型
 
 安裝qtqr
 apt-get install qtqr
 
安裝krita 
sudo apt-get install krita 
 
安裝3d printer cura

wget http://software.ultimaker.com/current/cura_15.04.5-debian_amd64.deb
 
dpkg -i cura_15.04.5-debian_amd64.deb
apt-get -f install

安裝電子書
apt-get install calibre 
安裝blueman
 apt-get install blueman

安裝bluegriffon
http://wdpsestea.blogspot.tw/2013/12/esteaubluegriffon.html

安裝ubuntu-tweak
wget http://getdeb.megaglest.org/ubuntu/pool/apps/u/ubuntu-tweak/ubuntu-tweak_0.8.7-1~getdeb2~xenial_all.deb
dpkg -i  
ubuntu-tweak_0.8.7-1~getdeb2~xenial_all.deb
 
 安裝fritzing
 apt-get install fritzing
 安裝kazam
apt-get install kazam
 安裝guvcview
apt-get install guvcview 

安裝
sublime-text 3 
 
sudo add-apt-repository ppa:webupd8team/sublime-text-3 
sudo apt-get update 
sudo apt-get install sublime-text-installer
 

http://opensource.ntpc.edu.tw/moodle/mod/forum/discuss.php?d=30
 
apt-get update卡住問題 
sudo -s
cd /etc/apt/apt.conf.d
vim 1000-force-ipv4-transport
貼入下列內容
Acquire::ForceIPv4 "true";

vim 1000-force-ipv6-transport
貼入下列內容

Acquire::ForceIPv6 "true";

開關機動畫改了
apt-get install plymouth-themes
位置在/usr/share/plymouth


99-arduino.rule
大量改檔名
中文解壓縮
 
打包改 pinguybuilder
apt-get install aufs-tools python-vte plymouth-x11
 dpkg -i pinguybuilder_4.3-8_all-beta.deb
 







apt-get update卡住問題

當有ivp6時做apt-get update會卡在一個地方,子忠解法。
sudo -s
cd /etc/apt/apt.conf.d
vim 1000-force-ipv4-transport
貼入下列內容
Acquire::ForceIPv4 "true";

vim 1000-force-ipv6-transport
貼入下列內容

Acquire::ForceIPv6 "true";

2016年5月10日

bpi m3 gpio 記事

傷腦筋好久了,終於解掉大部分問題了。
bpi m3 在gpio上終於解掉了。確定可以執行了。
安裝gpio
參考此篇文章:http://forum.banana-pi.org/t/how-to-banana-pi-bpi-m3-install-bpi-wiringpi/1056

使用git下載檔案
git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git -b BPI_M3

安裝
cd BPI-WiringPi
chmod +x ./build
sudo ./build 


做到這裡,個人遇到出現許多error,看了許多文章,仍未找到答案。
使用gpio -v 看到的都是不認識硬體的錯誤訊息 
看到了INSTALL後,應該是少了一個動作。
 
vim /etc/ld.so.conf 
在第一行加入路徑 
/usr/local/lib 

再重新編譯,這時就成功了。
使用gpio -v 可以得到

gpio version: 2.26
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Banana Pi Details:
  Type: Model BM, Revision: 1.2, Memory: 2048MB, Maker: BPI

執行gpio readall可以看到gpio全部設定
 
 +-----+-----+---------+------+---+---Pi ---+---+------+---------+-----+-----+
 | CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 | 229 |   8 |   SDA.1 | ALT5 | 0 |  3 || 4  |   |      | 5V      |     |     |
 | 228 |   9 |   SCL.1 | ALT5 | 0 |  5 || 6  |   |      | GND     |     |     |
 | 362 |   7 |    GCLK | ALT5 | 0 |  7 || 8  | 0 | ALT5 | TxD0    | 15  | 32  |
 |     |     |     GND |      |   |  9 || 10 | 0 | ALT5 | RxD0    | 16  | 33  |
 |  68 |   0 |    GEN0 |  OUT | 0 | 11 || 12 | 0 | ALT5 | GEN1    | 1   | 35  |
 |  71 |   2 |    GEN2 |  OUT | 1 | 13 || 14 |   |      | GND     |     |     |
 |  81 |   3 |    GEN3 |  OUT | 1 | 15 || 16 | 0 | ALT5 | GEN4    | 4   | 34  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | ALT3 | GEN5    | 5   | 360 |
 |  64 |  12 |    MOSI | ALT4 | 0 | 19 || 20 |   |      | GND     |     |     |
 |  65 |  13 |    MISO | ALT4 | 0 | 21 || 22 | 0 | OUT  | GEN6    | 6   | 361 |
 |  66 |  14 |    SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0     | 10  | 67  |
 |     |     |     GND |      |   | 25 || 26 | 0 | ALT3 | CE1     | 11  | 234 |
 | 227 |  30 |   SDA.0 | ALT5 | 0 | 27 || 28 | 0 | ALT5 | SCL.0   | 31  | 226 |
 |  82 |  21 | GPIO.21 | ALT3 | 0 | 29 || 30 |   |      | GND     |     |     |
 | 202 |  22 | GPIO.22 | ALT3 | 0 | 31 || 32 | 0 | ALT3 | GPIO.26 | 26  | 205 |
 | 203 |  23 | GPIO.23 | ALT3 | 0 | 33 || 34 |   |      | GND     |     |     |
 | 204 |  24 | GPIO.24 |  OUT | 1 | 35 || 36 | 0 | ALT3 | GPIO.27 | 27  | 133 |
 | 132 |  25 | GPIO.25 |  OUT | 0 | 37 || 38 | 0 | OUT  | GPIO.28 | 28  | 146 |
 |     |     |     GND |      |   | 39 || 40 | 0 | OUT  | GPIO.29 | 29  | 147 |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
 +-----+-----+---------+------+---+---Pi ---+---+------+---------+-----+-----+
 
這個結果和網站
https://bananapi.gitbooks.io/bpi-m3/content/bpi-m3_gpio_pin_define.html
 
上的圖有所不同。尤其是gpio的腳位。
 
測試:我用的是第37根針gpio.25,黑色是地線。
 
編輯一個檔案:blink.c
內容如下:
#include <wiringPi.h>
int main(void)
{
  wiringPiSetup() ;
  pinMode (25, OUTPUT) ;
  for(;;)
  {
    digitalWrite(25, HIGH) ; delay (500) ;
    digitalWrite(25,  LOW) ; delay (500) ;
  }
}
編譯: 
gcc -Wall -o blink blink.c -lwiringPi
 
測試
sudo ./blink 
這樣可以看到LED燈閃爍。