2017年9月27日 星期三

[RPi] 超頻

https://haydenjames.io/raspberry-pi-3-overclock/

arm_freq=1350
core_freq=500
over_voltage=4
disable_splash=1
#force_turbo=1 #Voids Warranty! (uncomment to avoid CPU scaling down to 600Mhz)
#boot_delay=1 #helps to avoid sdcard corruption when force_turbo is enabled.
#sdram_freq=500 #uncomment to test. Works only with some boards.

2017年9月24日 星期日

[Python] ImportError: cannot import name HashMissing

不知道為什麼 virtualEnv 爛掉了, 只要執行 pip 就會出現 ImportError: cannot import name HashMissing

假設 virtural env 的名稱為 ve, 就砍掉重鍊吧
rm -r ve/lib/python2.7/site-packages/{pip,setuptools} ve/lib/python2.7/site-packages/setuptools-* ve/lib/python2.7/site-packages/pip-*
virtualenv ve
source ve/bin/activate
pip install -U pip setuptools


https://stackoverflow.com/questions/43047336/how-to-solve-hashmissing-using-pip-in-python-2-7

2017年9月23日 星期六

[DB] 哪個資料庫好?

我也不知道 QQ

也許要測久一點才行吧

MySQL Vs. MariaDB Vs. Percona
Comparing Oracle MySQL, Percona Server and MariaDB
MySQL分支的選擇:Percona還是MariaDB
MySQL存儲引擎中的MyISAM和InnoDB

[Python] Enter another shell execute program

簡單說就是使用 subprocss 模組, 這篇寫得非常詳細, 這篇也可以看一下
Python Subprocess Module - Running external programs

但是使用上還是會有些問題, 雖然是寫說要用 communicate 才能避免 deadlock, 而不要直接寫 stdin, 但搭配這篇才能動 QQ
Understanding Popen.communicate

2017年9月19日 星期二

[AWS] 一些術語

設定新的 instance 會問網路設定該用哪種?


PlatformIntroduced inDescription
EC2-ClassicThe original release of Amazon EC2  Your instances run in a single, flat network that you share with other customers.
EC2-VPCThe original release of Amazon VPCYour instances run in a virtual private cloud (VPC) that's logically isolated to your AWS account.


* What is the difference between EC2-Classic and EC2-VPC?
* AWS VPC 心得

結論, 選 EC2-VPC

---

剛設完如果沒有 public DNS, 就參考這篇吧
* EC2 instance has no public DNS

---

之後用 ssh 測試可能會連不上, 第一個先修改 security group 的 inbound rules, 將 source 放寬看有沒有改善

然後用 ssh 連可能會失敗, 記得要修改 pem 的權限像這樣

instance:

  1. Open an SSH client. (find out how to connect using PuTTY)
  2. Locate your private key file (ricelee.pem). The wizard automatically detects the key you used to launch the instance.
  3. Your key must not be publicly viewable for SSH to work. Use this command if needed:
    chmod 400 foo.pem
  4. Connect to your instance using its Public DNS:
    ec2-1-2-3-4.ap-northeast-1.compute.amazonaws.com
Example:
ssh -i "foo.pem" ubuntu@ec2-1-2-3-4.ap-northeast-1.compute.amazonaws.com
Please note that in most cases the username above will be correct, however please ensure that you read your AMI usage instructions to ensure that the AMI owner has not changed the default AMI username.


2017年9月17日 星期日

[AWS] 測試與轉移

做什麼都要先備份或測試

1. snapshot
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html

---
To create a snapshot using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. Choose Snapshots in the navigation pane.
  3. Choose Create Snapshot.
  4. In the Create Snapshot dialog box, select the volume to create a snapshot for, and then choose Create.
---


2. 測試 snapshot
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-launch-snapshot.html

---
To create an AMI from your root volume using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. In the navigation pane, choose Elastic Block Store, Snapshots.
  3. Choose Create Snapshot.
  4. For Volumes, start typing the name or ID of the root volume, and then select it from the list of options.
  5. Choose the snapshot that you just created, and then choose Actions, Create Image.
  6. In the Create Image from EBS Snapshot dialog box, provide the following information and then choose Create. If you're re-creating a parent instance, then choose the same options as the parent instance.
    • Architecture: Choose i386 for 32-bit or x86_64 for 64-bit.
    • Root device name: Enter the appropriate name for the root volume. For more information, see Device Naming on Linux Instances.
    • Virtualization type: Choose whether instances launched from this AMI use paravirtual (PV) or hardware virtual machine (HVM) virtualization. For more information, see Linux AMI Virtualization Types.
    • (PV virtualization type only) Kernel ID and RAM disk ID: Choose the AKI and ARI from the lists. If you choose the default AKI or don't choose an AKI, you'll be required to specify an AKI every time you launch an instance using this AMI. In addition, your instance may fail the health checks if the default AKI is incompatible with the instance.
    • (Optional) Block Device Mappings: Add volumes or expand the default size of the root volume for the AMI. For more information about resizing the file system on your instance for a larger volume, see Extending a Linux File System after Resizing the Volume.
  7. In the navigation pane, choose AMIs.
  8. Choose the AMI that you just created, and then choose Launch. Follow the wizard to launch your instance. For more information about how to configure each step in the wizard, see Launching an Instance.
---















2017年9月16日 星期六

[MySQL] Error establishing a database connection

太久沒有管 MySQL 就會有奇怪的問題, 所以也不太確定問題的由來, 只能用土法解決

InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./mysql/innodb_index_stats.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it. 
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

先直接講解法好了, 就是在 my.cnf 多設定一行
nnodb_force_recovery = 1

重啟 MySQL 後再註解掉就可以了


參考: http://linux-server-tutorial.blogspot.tw/2014/02/mysql-is-not-starting-operating-system.html





2017年9月12日 星期二

2017年9月5日 星期二

[RPi] Duckietown

Duckietown an Open, Inexpensive and Flexible Platform for Autonomy Education and Research
http://duckietown.nctu.edu.tw/materials/paull-2017-icra-duckietown.pdf

這也有翻譯欸
http://blog.csdn.net/robocoder/article/details/53098753

2017年9月4日 星期一

[資訊科學] 如何在嵌入式系統中使用 IMU (加速度計與陀螺儀)

A Guide To using IMU (Accelerometer and Gyroscope Devices) in Embedded Applications.

有人翻譯了這篇文章, 紀錄一下
http://silverwind1982.pixnet.net/blog/post/280287502